Private
Public Access
poll_due_feeds loaded every active feed's timing fields and recomputed each one's error-backoff due-ness in Python on every beat tick (every 1-2 minutes) — scheduler CPU and DB reads grew linearly with total feed count regardless of how many were actually due. Feed.next_fetch_at (indexed together with is_active) is now set by fetch_feed itself right after every fetch attempt, success or error, using the same backoff formula that used to run per-feed in poll_due_feeds. The scheduler's query is now a direct indexed range scan (next_fetch_at <= now), ordered so the most overdue feeds claim first, and bounded to POLL_BATCH_SIZE so a large backlog spreads across several ticks instead of dispatching everything at once. A migration backfills next_fetch_at for existing feeds using the same formula. reset_feed_backoff also clears next_fetch_at so a manually-reset feed is immediately due again, matching its prior behavior. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>