Fix dashboard 500s: raise httpx read timeout on /team/list + /spend/logs calls
This commit is contained in:
1 parent
2ff8193c55
commit
4600a69cac
1 file changed
+7
-2
+7
-2
@@ -788,7 +788,9 @@ async def litellm_get_or_create_team(email: str, budget: float) -> str:
|
|||||||
check /team/list first.
|
check /team/list first.
|
||||||
"""
|
"""
|
||||||
alias = f"member:{email}"
|
alias = f"member:{email}"
|
||||||
async with httpx.AsyncClient() as client:
|
# /team/list has grown slow as usage accumulates; the httpx default 5s
|
||||||
|
# read timeout was too short (root cause of dashboard 500s on 2026-09-26).
|
||||||
|
async with httpx.AsyncClient(timeout=httpx.Timeout(connect=15.0, read=60.0, write=15.0, pool=15.0)) as client:
|
||||||
r = await client.get(
|
r = await client.get(
|
||||||
f"{LITELLM_BASE}/team/list",
|
f"{LITELLM_BASE}/team/list",
|
||||||
headers={"Authorization": f"Bearer {LITELLM_MASTER_KEY}"},
|
headers={"Authorization": f"Bearer {LITELLM_MASTER_KEY}"},
|
||||||
@@ -1490,7 +1492,10 @@ async def broker_get_usage(email: str) -> dict:
|
|||||||
spend = 0.0
|
spend = 0.0
|
||||||
reset_at = None
|
reset_at = None
|
||||||
|
|
||||||
async with httpx.AsyncClient() as client:
|
# /team/list and /spend/logs have grown slow as usage accumulates; the
|
||||||
|
# httpx default 5s read timeout was too short and made /broker/usage 500.
|
||||||
|
client_timeout = httpx.Timeout(connect=15.0, read=60.0, write=15.0, pool=15.0)
|
||||||
|
async with httpx.AsyncClient(timeout=client_timeout) as client:
|
||||||
# 1. Team spend + budget
|
# 1. Team spend + budget
|
||||||
r = await client.get(
|
r = await client.get(
|
||||||
f"{LITELLM_BASE}/team/list",
|
f"{LITELLM_BASE}/team/list",
|
||||||
|
|||||||
Reference in new issue
Block a user