mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 19:24:27 +00:00
(fix) improve /health/readiness under high load
This commit is contained in:
parent
61f129b9ab
commit
389e79d3b2
1 changed files with 2 additions and 4 deletions
|
@ -7280,10 +7280,8 @@ def _db_health_readiness_check():
|
||||||
# Note - Intentionally don't try/except this so it raises an exception when it fails
|
# Note - Intentionally don't try/except this so it raises an exception when it fails
|
||||||
|
|
||||||
# if timedelta is less than 2 minutes return DB Status
|
# if timedelta is less than 2 minutes return DB Status
|
||||||
if (
|
time_diff = datetime.now() - db_health_cache["last_updated"]
|
||||||
db_health_cache["status"] != "unknown"
|
if db_health_cache["status"] != "unknown" and time_diff < timedelta(minutes=2):
|
||||||
and db_health_cache["last_updated"] + timedelta(minutes=2) > datetime.now()
|
|
||||||
):
|
|
||||||
return db_health_cache
|
return db_health_cache
|
||||||
prisma_client.health_check()
|
prisma_client.health_check()
|
||||||
db_health_cache = {"status": "connected", "last_updated": datetime.now()}
|
db_health_cache = {"status": "connected", "last_updated": datetime.now()}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue