mirror of
https://github.com/rommapp/romm.git
synced 2026-12-04 21:02:21 +01:00
* perf(gunicorn): preload the app so web workers share its memory Each gunicorn worker imported the whole app on its own, ~160 MB private per worker. Preloading imports it once in the master; gc.freeze keeps the shared pages from being copied when workers collect garbage. - gunicorn.conf.py: GC off during import, OpenAPI schema built and all objects frozen before fork, inherited SQL pool dropped in each worker - Socket.IO managers renew their pub/sub host ID after fork, otherwise preloaded workers drop each other's emits as their own - WEB_SERVER_CONCURRENCY defaults to 2 - Page limit capped at 1,000 (was 10,000): a worker keeps the memory of its largest response until recycled; select-all pages by 1,000 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(gunicorn): address Greptile review on the preload change - Shorten the renew_host_id docstring and the gunicorn.conf.py comment - Close the fork test's pipe in a finally block - Test that when_ready builds the schema before freezing and re-enabling the GC, and that post_fork disposes the pool with close=False Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(gunicorn): WEB_SERVER_PRELOAD switch and an import fork-safety test - WEB_SERVER_PRELOAD (default true) sets preload_app from the gunicorn config; false restores per-worker imports and skips every hook - tests/test_api_import_is_fork_safe.py imports main in a fresh interpreter with the database on a closed port and fails if the import opens a connection or starts a thread (adapted from #5735) - BACKEND_ARCHITECTURE notes the preload and what it requires of imports Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(coherence): record the invariant run for the preload change Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test: drop trunk-ignore comments bandit never needed in tests Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>