From 29bd2ceb2b5c8f2a172d6b08e6c54cb20c41daaa Mon Sep 17 00:00:00 2001 From: yucheng Date: Sun, 20 Sep 2026 08:27:06 +0000 Subject: [PATCH] fix(proxy): avoid mutable shutdown wait set Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- litellm/proxy/shutdown/scheduled_jobs.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/litellm/proxy/shutdown/scheduled_jobs.py b/litellm/proxy/shutdown/scheduled_jobs.py index e7625a73b47..5345d380112 100644 --- a/litellm/proxy/shutdown/scheduled_jobs.py +++ b/litellm/proxy/shutdown/scheduled_jobs.py @@ -50,12 +50,13 @@ async def stop_in_flight_scheduler_jobs(scheduler: StoppableScheduler, executor: if not scheduler.running: return in_flight: Final = executor.in_flight_jobs() - still_running: set[asyncio.Future[object]] = set() if in_flight: verbose_proxy_logger.info( "Waiting up to %ss for %d in-flight scheduled job(s) to finish", JOB_FINISH_TIMEOUT_SECONDS, len(in_flight) ) - _done, still_running = await asyncio.wait(in_flight, timeout=JOB_FINISH_TIMEOUT_SECONDS) + still_running: Final = ( + (await asyncio.wait(in_flight, timeout=JOB_FINISH_TIMEOUT_SECONDS))[1] if in_flight else frozenset() + ) scheduler.shutdown(wait=False) if not still_running: return