Fix Discord pick notifications silently dropped during autodraft chains #57

Merged
chrisp merged 1 commit from fix/discord-pick-notification-queue into main 2026-05-27 16:41:08 +00:00

1 commit

Author SHA1 Message Date
Chris Parsons
fa85786401 Fix Discord pick notifications silently dropped during autodraft chains
All checks were successful
🚀 Deploy / 🧪 Test (pull_request) Successful in 1m29s
🚀 Deploy / ʦ TypeScript (pull_request) Successful in 1m20s
🚀 Deploy / 🔍 Lint (pull_request) Successful in 50s
🚀 Deploy / 🐳 Build (pull_request) Has been skipped
🚀 Deploy / 🚀 Deploy (pull_request) Has been skipped
Three issues identified by code review:

1. Per-league queue: replace single global queue with a Map keyed by leagueId
   so concurrent drafts in different leagues don't block each other.

2. Deadlock fix: wrap drainer body in try/finally so drainingLeagues is always
   cleaned up even if a task throws unexpectedly, preventing the queue from
   being permanently stuck.

3. Wait cap fix: move Math.min to wrap the full backoff expression
   (retryAfter * (attempt+1)) so the 10s ceiling applies to the product, not
   just the base — settings actions were previously blockable for up to 30s.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-27 09:36:32 -07:00