Skip to content

Anchor probe ticks to the phase end so stagger actually spreads load - #63

Merged
Yanujz merged 1 commit into
mainfrom
issue-61-stagger-fix
Sep 19, 2026
Merged

Yanujz merged 1 commit into
mainfrom
issue-61-stagger-fix

Conversation

@Yanujz

@Yanujz Yanujz commented Sep 19, 2026

Copy link
Copy Markdown
Collaborator

What changes for operators?

The #29 stagger now works as documented: same-interval services spread first ticks across the period instead of firing in lockstep. Measured: two services with 5ms/45ms phases went from 62µs tick alignment to ~40ms separation. No cadence change per service.

Failing-then-passing test

New TestSchedulerStaggerSeparates (two services, in-range phases, absolute second-tick gap ≥ 20ms): fails on current code (328µs), passes with the fix; stable across -race runs. Existing stagger bounds tests unaffected.

Checklist

  • go build ./... && go vet ./... && go test ./... green with -race (scheduler package; full suite at merge)
  • gofmt -l . clean
  • OpenAPI updated if API surface changed — N/A
  • No fabricated history — probe cadence per service unchanged
  • No secrets, tokens, or hosts I don't own in the diff

Fixes #61

The ticker was created at loop start, so ticks stayed anchored to
creation and the phase wait (always shorter than one interval) never
moved them: same-period services probed in lockstep despite #29. Start
the ticker after the phase wait; steady period unchanged, shutdown
during phasing still exits via context.

Fixes #61
@Yanujz
Yanujz merged commit 5827fe8 into main Sep 19, 2026
1 check passed
@Yanujz
Yanujz deleted the issue-61-stagger-fix branch September 19, 2026 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Scheduler stagger is a no-op — ticker anchors to loop start, not phase end

1 participant