fix: /health/ready status mapping (up/down → ok/fail)
This commit is contained in:
@@ -55,7 +55,12 @@ async def health_ready() -> ReadyResponse:
|
|||||||
# health is a dict (or HealthResponse), handle both
|
# health is a dict (or HealthResponse), handle both
|
||||||
health_checks = health.get('checks', {}) if isinstance(health, dict) else (health.checks or {})
|
health_checks = health.get('checks', {}) if isinstance(health, dict) else (health.checks or {})
|
||||||
for check_name, check_val in health_checks.items():
|
for check_name, check_val in health_checks.items():
|
||||||
status = "ok" if check_val == "ok" or check_val is True else "fail"
|
# Handle both string status and dict with status key
|
||||||
|
if isinstance(check_val, dict):
|
||||||
|
status_val = check_val.get("status", "unknown")
|
||||||
|
else:
|
||||||
|
status_val = str(check_val)
|
||||||
|
status = "ok" if status_val in ("ok", "up", "healthy", "true", "True") else "fail"
|
||||||
checks[check_name] = status
|
checks[check_name] = status
|
||||||
if status != "ok":
|
if status != "ok":
|
||||||
all_ready = False
|
all_ready = False
|
||||||
|
|||||||
Reference in New Issue
Block a user