From de849bff75947a9a9687f206a0522e5ebebbbec7 Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Fri, 1 May 2026 12:51:15 -0700 Subject: [PATCH] address greptile review feedback (greploop iteration 5) - Sweep expired tasks before counting active to prevent false 429s Co-Authored-By: Claude Opus 4.6 --- litellm/proxy/scheduled_tasks/endpoints.py | 1 + 1 file changed, 1 insertion(+) diff --git a/litellm/proxy/scheduled_tasks/endpoints.py b/litellm/proxy/scheduled_tasks/endpoints.py index cab24136fd8..8d1c89b6215 100644 --- a/litellm/proxy/scheduled_tasks/endpoints.py +++ b/litellm/proxy/scheduled_tasks/endpoints.py @@ -117,6 +117,7 @@ async def create_scheduled_task( owner_token = _require_token(user_api_key_dict) prisma_client = _get_prisma_client() + await store.sweep_expired_for_owner(prisma_client, owner_token) active = await store.count_active_for_owner(prisma_client, owner_token) if active >= store.MAX_ACTIVE_TASKS_PER_KEY: raise HTTPException(