INNER CODE UNIT · Python
readiness_check
AleksNeStu/ai-real-estate-assistant · apps/api/api/main.py:642
async def readiness_check():
"""
K8s readiness probe - checks if app can serve traffic.
Returns 200 if all critical dependencies are available.
"""
health = await get_health_status(include_dependencies=True)
# Only vector_store is critical for serving traffic
vs_health = health.dependencies.get("vector_store")
if vs_health and vs_health.status == HealthStatus.UNHEALTHY:
return JSONResponse(
content={"status": "not_ready", "reason": "vector_store_unhealthy"}, status_code=503
)
return {"status": "ready"}
@app.get("/health/live", tags=["System"])