From 46a56664fef66cb52add4c352254fc3e1a6002eb Mon Sep 17 00:00:00 2001 From: Joshua Valluru <326636767+joshua-berri@users.noreply.github.com> Date: Wed, 28 Oct 2026 17:14:02 -0700 Subject: [PATCH] fix: catch shutdown timeouts on Python 3.10 --- litellm/proxy/proxy_server.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py index 3e302f5035e..bf822876383 100644 --- a/litellm/proxy/proxy_server.py +++ b/litellm/proxy/proxy_server.py @@ -1285,12 +1285,12 @@ async def _flush_spend_around_logging_drain_on_shutdown( verbose_proxy_logger.info("Draining success callbacks before the final spend flush") try: await asyncio.wait_for(GLOBAL_LOGGING_WORKER.flush(), timeout=GracefulShutdownManager.get_timeout()) - except TimeoutError: + except asyncio.TimeoutError: verbose_proxy_logger.warning("Timed out draining success callbacks on shutdown; accounting may be incomplete") finally: try: await asyncio.wait_for(GLOBAL_LOGGING_WORKER.stop(discard_pending=True), timeout=5.0) - except TimeoutError: + except asyncio.TimeoutError: verbose_proxy_logger.warning("Timed out cancelling success callbacks on shutdown") await drain_logging_tasks() await flush_spend()