Server settings → Overview: every visit walks the whole media directory to count files and bytes #488
Labels
No labels
accessibility
authentication
breaking change
bug
documentation
enhancement
interface
internationalisation
observability
performance
security
tier
1
tier
2
tier
3
tier/4
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Postulo/postulo#488
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Found on 2026-09-29 in a read-only review of postulo at
95348908d, reading the Overview view and timing its directory walk.Checked again on 2026-10-01 against
mainat0a5cad587: still present.The Overview page, where
/server/redirects, counts the files underMEDIA_ROOTand adds up their sizes on every request. It does so withrglob("*")plus anis_file()and astat()for each entry, across every account's uploads, rendered documents and kept capture pages, synchronously and with nothing cached. The cost grows with the instance's whole history and is paid on each visit.core/server_views.py:65-73,_directory_size; called fromOverviewView.get_context_dataat:134.stat().updates.status()), or have the scheduler's pass compute and store it and let the page show what was stored with its age; alternatively sum the sizes the database already records for the files it owns and walk the directory only on request.Done when
tests/test_server_settings.pyrenders the Overview twice with_directory_sizepatched to count its calls and finds it called at most once; it fails today with two.Landed on main with a green Forgejo CI run. Its entry in the CHANGELOG's Unreleased section ends in (#488).