This commit is contained in:
caramelteawithmint
2026-11-20 11:19:14 +03:00
parent 276dbdad8a
commit 2b68813b33
24 changed files with 1516 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
from fastapi import APIRouter, Request
from fastapi.responses import JSONResponse
from ..db import connection
from ..errors import error_response
router = APIRouter()
@router.get("/health/live")
def live():
return {"status": "ok"}
@router.get("/health/ready")
def ready(request: Request):
try:
with connection() as conn:
with conn.cursor() as cur:
cur.execute("SELECT 1")
cur.fetchone()
except Exception:
return error_response(
request, 503, "unavailable", "Зависимость недоступна"
)
return {"status": "ok"}