add code for level 4

This commit is contained in:
Матвей
2026-10-14 15:25:51 +03:00
parent 6e7b8007ac
commit 516bb095ac
11 changed files with 175 additions and 13 deletions
+3 -1
View File
@@ -79,7 +79,9 @@ async def liveness() -> dict[str, str]:
return {"status": "ok"}
@router.get("/health/ready")
async def readiness(store: PostgresStore = Depends(get_store)) -> dict[str, str]:
async def readiness(request: Request, store: PostgresStore = Depends(get_store)) -> dict[str, str]:
if not request.app.state.accepting_requests:
raise ApiError(503, "unavailable", "API завершает работу")
await store.ready()
return {"status": "ok"}