INNER CODE UNIT · Python

_lifespan

av1155/houndarr · src/houndarr/app.py:69

async def _lifespan(app: FastAPI) -> AsyncGenerator[None]:
    """Application lifespan: initialize DB on startup, clean up on shutdown."""
    settings = get_settings()

    # Runs before the fatal checks below so the operator still sees it on a
    # failed boot.  A TZ the C library cannot load leaves local time on UTC,
    # which only the allowed search window reads, and it does so silently.
    bad_tz = unresolved_timezone(os.environ.get("TZ"))
    if bad_tz is not None:
        logger.warning(
            "TZ=%s is not a timezone Houndarr can load; using UTC instead. "
            "Allowed Search Window times will be UTC until TZ names a zone "
            "this install has, such as America/New_York.",
            bad_tz,
        )

    # Defense-in-depth: validate auth config even if __main__ already did.
    # Covers cases where create_app() is called directly (tests, ASGI server).

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…