INNER CODE UNIT · Python

_bounded_readiness

shenmintao/marginalia · src/marginalia/main.py:346

async def _bounded_readiness(check, timeout_seconds: float) -> str:  # noqa: ANN001
    try:
        await asyncio.wait_for(check, timeout=timeout_seconds)
    except Exception:
        return "error"
    return "ok"


async def _database_ready() -> None:
    async with get_engine().connect() as connection:
        await connection.execute(text("SELECT 1"))


@app.get("/ready", tags=["meta"], response_model=None)
async def ready() -> Any:
    """Dependency readiness for traffic admission; never calls an LLM."""
    settings = get_settings()
    database, storage = await asyncio.gather(

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…