allow disabling preload for faster startup times on larger installs

Signed-off-by: David Young <davidy@funkypenguin.co.nz>
This commit is contained in:
David Young
2025-12-10 16:38:22 +13:00
parent 9cf0472246
commit 738912d2dd
4 changed files with 4 additions and 1 deletions
+1
View File
@@ -21,6 +21,7 @@ FASTAPI_HOST=0.0.0.0
FASTAPI_PORT=8000
FASTAPI_WORKERS=1 # set to -1 for auto-scaling (min((os.cpu_count() or 1) * 2 + 1, 12))
USE_GUNICORN=True # Will use uvicorn if False or if on Windows
GUNICORN_PRELOAD_APP=True # Set to False to start workers without preloading the app (reduces startup cost but requires schema to exist)
# ============================== #
# Dashboard Settings #
+1
View File
@@ -8,6 +8,7 @@
* add optional PostgreSQL read replica routing with transparent primary fallback
* add optional database-backed anime mapping cache with configurable refresh interval
* add `GUNICORN_PRELOAD_APP` setting to control whether workers inherit a preloaded app or initialize independently
* add `DATABASE_STARTUP_CLEANUP_INTERVAL` to throttle heavy startup cleanup sweeps across workers
## [2.31.0](https://github.com/g0ldyy/comet/compare/v2.30.0...v2.31.0) (2025-12-08)
+1
View File
@@ -26,6 +26,7 @@ class AppSettings(BaseSettings):
FASTAPI_PORT: Optional[int] = 8000
FASTAPI_WORKERS: Optional[int] = 1
USE_GUNICORN: Optional[bool] = True
GUNICORN_PRELOAD_APP: Optional[bool] = True
ADMIN_DASHBOARD_PASSWORD: Optional[str] = "".join(
random.choices(string.ascii_letters + string.digits, k=16)
)
+1 -1
View File
@@ -104,7 +104,7 @@ def run_with_gunicorn():
"worker_class": "uvicorn.workers.UvicornWorker",
"timeout": 120,
"keepalive": 5,
"preload_app": True,
"preload_app": bool(settings.GUNICORN_PRELOAD_APP),
"proxy_protocol": True,
"forwarded_allow_ips": "*",
"loglevel": "warning",