исправила замечания

This commit is contained in:
2026-10-31 11:02:37 +03:00
parent e135f1c5d4
commit e3d441c629
6 changed files with 127 additions and 77 deletions
+13 -3
View File
@@ -47,7 +47,11 @@ def _rid(request):
def error_response(request, status, code, message, headers=None):
rid = _rid(request)
out = {"X-Request-Id": rid, "Cache-Control": "no-store"}
out = {
"X-Request-Id": rid,
"X-Instance-Id": INSTANCE_ID,
"Cache-Control": "no-store",
}
out.update(headers or {})
return JSONResponse(status_code=status, content=make_error(code, message, rid), headers=out)
@@ -131,8 +135,14 @@ def live():
@app.get("/health/ready")
def ready():
db.ping()
s3.ping()
try:
db.ping()
except Exception:
raise ApiError(503, "unavailable", "PostgreSQL недоступен")
try:
s3.ping()
except Exception:
raise ApiError(503, "unavailable", "S3 недоступен")
return {"status": "ok"}