feat: graceful shutdown and WAL cleanup
Some checks failed
CI / Backend Tests (push) Has been cancelled
CI / Lint (push) Has been cancelled
CI / Type Check (push) Has been cancelled
CI / Import Boundary (push) Has been cancelled
CI / OpenAPI Breaking Changes (push) Has been cancelled
CI / OpenAPI Baseline Commit (push) Has been cancelled
Some checks failed
CI / Backend Tests (push) Has been cancelled
CI / Lint (push) Has been cancelled
CI / Type Check (push) Has been cancelled
CI / Import Boundary (push) Has been cancelled
CI / OpenAPI Breaking Changes (push) Has been cancelled
CI / OpenAPI Baseline Commit (push) Has been cancelled
- Add stop_grace_period to backend container for graceful shutdown - Document WAL mode rationale and orphaned file cleanup in db.py - Handle database close errors gracefully in lifespan - Clean up orphaned WAL files during startup before opening DB - Reorder imports and fix formatting in startup.py
This commit was merged in pull request #4.
This commit is contained in:
@@ -318,7 +318,12 @@ async def _lifespan(app: FastAPI) -> AsyncGenerator[None, None]:
|
||||
log.error("scheduler_lock_release_failed", error=str(e))
|
||||
|
||||
# 6. Close the database connection.
|
||||
await startup_db.close()
|
||||
try:
|
||||
await startup_db.close()
|
||||
log.debug("database_connection_closed")
|
||||
except Exception as exc:
|
||||
log.error("database_connection_close_failed", error=str(exc))
|
||||
|
||||
log.info("bangui_shut_down")
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user