mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-16 23:41:43 +00:00
[Fix] guard get_proxy_server_request_headers and bound atexit flush
- get_proxy_server_request_headers raised AttributeError when
litellm_params["proxy_server_request"] was set to None (the default
for SDK callers). Guard the helper so it returns {} for None or
non-dict values.
- LoggingWorker._flush_on_exit now wraps each queued coroutine in
asyncio.wait_for(..., timeout=2.0) so a single hung coroutine cannot
block the atexit handler past the outer 5s budget.
- Drop _turn_on_debug() from test_vertex_schema_test to reduce noise on
a network-dependent test.
This commit is contained in:
parent
d21e90f683
commit
caec9ed583
3 changed files with 10 additions and 9 deletions
|
|
@ -77,8 +77,8 @@ def get_proxy_server_request_headers(litellm_params: Optional[dict]) -> dict:
|
|||
if litellm_params is None:
|
||||
return {}
|
||||
|
||||
proxy_request_headers = (
|
||||
litellm_params.get("proxy_server_request", {}).get("headers", {}) or {}
|
||||
)
|
||||
proxy_server_request = litellm_params.get("proxy_server_request") or {}
|
||||
if not isinstance(proxy_server_request, dict):
|
||||
return {}
|
||||
|
||||
return proxy_request_headers
|
||||
return proxy_server_request.get("headers") or {}
|
||||
|
|
|
|||
|
|
@ -507,11 +507,13 @@ class LoggingWorker:
|
|||
except asyncio.QueueEmpty:
|
||||
break
|
||||
|
||||
# Run the coroutine synchronously in new loop
|
||||
# Note: We run the coroutine directly, not via create_task,
|
||||
# since we're in a new event loop context
|
||||
# Run the coroutine synchronously in new loop with a per-task
|
||||
# timeout so a single hung coroutine cannot block the entire
|
||||
# flush past the outer time budget.
|
||||
try:
|
||||
loop.run_until_complete(task["coroutine"])
|
||||
loop.run_until_complete(
|
||||
asyncio.wait_for(task["coroutine"], timeout=2.0)
|
||||
)
|
||||
processed += 1
|
||||
except Exception:
|
||||
# Silent failure to not break user's program
|
||||
|
|
|
|||
|
|
@ -3688,7 +3688,6 @@ def test_vertex_ai_llama_tool_calling():
|
|||
|
||||
def test_vertex_schema_test():
|
||||
load_vertex_ai_credentials()
|
||||
litellm._turn_on_debug()
|
||||
|
||||
def tool_call(text: str | None) -> str:
|
||||
return text or "No text provided"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue