db error
This commit is contained in:
+19
-14
@@ -785,20 +785,25 @@ async def health() -> HealthResponse:
|
|||||||
radarr_db_health = None
|
radarr_db_health = None
|
||||||
overall_status = "healthy" if db_status == "healthy" else "degraded"
|
overall_status = "healthy" if db_status == "healthy" else "degraded"
|
||||||
|
|
||||||
# Get Radarr client with database access
|
# Get Radarr client with database access from movie processor
|
||||||
radarr_client = client_manager.get_radarr_client()
|
try:
|
||||||
if radarr_client and hasattr(radarr_client, 'db_client') and radarr_client.db_client:
|
if hasattr(movie_processor, 'radarr') and movie_processor.radarr:
|
||||||
try:
|
radarr_client = movie_processor.radarr
|
||||||
radarr_db_health = radarr_client.db_client.health_check()
|
if hasattr(radarr_client, 'db_client') and radarr_client.db_client:
|
||||||
if radarr_db_health["status"] != "healthy":
|
try:
|
||||||
overall_status = "degraded"
|
radarr_db_health = radarr_client.db_client.health_check()
|
||||||
except Exception as e:
|
if radarr_db_health["status"] != "healthy":
|
||||||
radarr_db_health = {
|
overall_status = "degraded"
|
||||||
"status": "error",
|
except Exception as e:
|
||||||
"error": str(e),
|
radarr_db_health = {
|
||||||
"tested_at": datetime.now(timezone.utc).isoformat(timespec="seconds")
|
"status": "error",
|
||||||
}
|
"error": str(e),
|
||||||
overall_status = "degraded"
|
"tested_at": datetime.now(timezone.utc).isoformat(timespec="seconds")
|
||||||
|
}
|
||||||
|
overall_status = "degraded"
|
||||||
|
except Exception as e:
|
||||||
|
# If movie processor isn't available, skip database health check
|
||||||
|
_log("DEBUG", f"Skipping Radarr database health check: {e}")
|
||||||
|
|
||||||
return HealthResponse(
|
return HealthResponse(
|
||||||
status=overall_status,
|
status=overall_status,
|
||||||
|
|||||||
Reference in New Issue
Block a user