исправила замечания
This commit is contained in:
@@ -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"}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user