Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

fix(logging_worker): bound flush-rescued coroutines with the worker timeout

mateo-berria4834cbbf55c
diff --git a/litellm/litellm_core_utils/logging_worker.py b/litellm/litellm_core_utils/logging_worker.py
index c5da732f63c..e1501ce5325 100644
--- a/litellm/litellm_core_utils/logging_worker.py
+++ b/litellm/litellm_core_utils/logging_worker.py
@@ -76,10 +76,9 @@ class LoggingWorker:
if inspect.getcoroutinestate(task["coroutine"]) == inspect.CORO_CREATED
)
- @staticmethod
- def _run_coroutine_silently(loop: asyncio.AbstractEventLoop, coroutine: Coroutine) -> bool:
+ def _run_coroutine_silently(self, loop: asyncio.AbstractEventLoop, coroutine: Coroutine) -> bool:
try:
- loop.run_until_complete(coroutine)
+ loop.run_until_complete(asyncio.wait_for(coroutine, timeout=self.timeout))
except Exception: # noqa: BLE001 # atexit flush must never break the user's program
return False
return True