INNER CODE UNIT · Python

health

KatrielMoses/voidaccess · api/main.py:585

async def health() -> dict:
    """Returns API, DB, and Tor connectivity status (async)."""
    checks = {}
    db_result, tor_result = await asyncio.gather(
        _check_db_connectivity_async(),
        _check_tor_connectivity_async(),
    )
    checks["database"] = db_result
    checks["tor"] = tor_result

    status = "healthy" if all(v == "ok" for v in checks.values()) else "degraded"
    return {"status": status, "checks": checks}


@app.get("/healthz/live", tags=["health"])
async def liveness() -> dict:
    """Liveness probe — always 200 unless process is wedged."""
    return {"status": "alive"}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…