From a4834cbbf55c14c5c7528ee9e2e65a8da0bdc15a Mon Sep 17 00:00:00 2001 From: mateo-berri <277851410+mateo-berri@users.noreply.github.com> Date: Wed, 26 Aug 2026 12:58:02 -0700 Subject: [PATCH] fix(logging_worker): bound flush-rescued coroutines with the worker timeout --- litellm/litellm_core_utils/logging_worker.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 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