INNER CODE UNIT · Python
_close_db_and_record_clean_shutdown
Soju06/codex-lb · app/main.py:401
async def _close_db_and_record_clean_shutdown(
*,
database_tasks_drained: bool,
leader_lease_release_completed: bool,
) -> None:
"""Dispose the database engines, then record the shutdown as clean.
The record is only reached once disposal returns and every database-owning
shutdown drain completed. A cancellation, failed dispose, or abandoned
drain must leave the run state unclean, because that is exactly the
incomplete shutdown the next startup's integrity scan is for.
"""
sqlite_teardown_drained = await close_db()
if sqlite_teardown_drained and database_tasks_drained and leader_lease_release_completed:
mark_sqlite_shutdown_clean()
async def _purge_operation_spool_on_startup(*, retention_seconds: float) -> int: