address greptile review feedback (greploop iteration 5)

- Sweep expired tasks before counting active to prevent false 429s

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Krrish Dholakia 2026-05-01 12:51:15 -07:00
parent cbc0cb5196
commit de849bff75

View file

@ -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(