DB background worker cleanup, avoid issue with double cleanup. Faster write to disk.

This commit is contained in:
2026-01-27 22:21:33 +00:00
parent ddd70e6130
commit 9b505ff553
4 changed files with 10 additions and 39 deletions
+3 -1
View File
@@ -9,6 +9,7 @@ from fastapi.responses import FileResponse, RedirectResponse
from fastapi_vue import Frontend
from paskia import globals
from paskia.db import start_background, stop_background
from paskia.fastapi import admin, api, auth_host, ws
from paskia.fastapi.session import AUTH_COOKIE
from paskia.util import hostutil, passphrase, vitedev
@@ -32,7 +33,6 @@ async def lifespan(app: FastAPI): # pragma: no cover - startup path
so that uvicorn reload / multiprocess workers inherit the settings.
All keys are guaranteed to exist; values are already normalized by __main__.py.
"""
config = json.loads(os.environ["PASKIA_CONFIG"])
try:
@@ -54,7 +54,9 @@ async def lifespan(app: FastAPI): # pragma: no cover - startup path
logging.getLogger("uvicorn.access").setLevel(logging.INFO)
await frontend.load()
await start_background()
yield
await stop_background()
app = FastAPI(lifespan=lifespan, redirect_slashes=False)