Skip to content

perf(cursored-scheduler): Retry an empty cycle once per cycle duration - #122463

Draft
shellmayr wants to merge 1 commit into
masterfrom
feat/cursored-scheduler-empty-cycle-backoff
Draft

perf(cursored-scheduler): Retry an empty cycle once per cycle duration#122463
shellmayr wants to merge 1 commit into
masterfrom
feat/cursored-scheduler-empty-cycle-backoff

Conversation

@shellmayr

Copy link
Copy Markdown
Member
  • A cycle that snapshots no PKs finalizes on the tick that starts it, so the cursor returns to 0 and the next tick re-runs the cycle-start query. For a queryset that stays empty that repeats every tick interval — with the dynamic sampling scheduler's 10s tick, one full query every 10 seconds
  • Adds a cursored_scheduler_empty_cycle:{name} cache entry recording when a cycle last started empty. While less than cycle_duration has passed, tick() returns early without touching the database and increments cursored_scheduler.empty_cycle_backoff
  • A cycle that finds work deletes the entry, so a normally completing cycle restarts on the next tick exactly as before

Contributes to TET-2820

A cycle that snapshots no PKs finalizes on the tick that starts it, so the cursor is back at 0 and the next tick runs the cycle-start query again. For a queryset that stays empty that repeats every tick interval.

A cache entry records when a cycle last started empty, and a new cycle is not started again until cycle_duration has passed. A cycle that finds work clears the entry and restarts as before.
@linear-code

linear-code Bot commented Aug 24, 2026

Copy link
Copy Markdown

TET-2820

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant