Anchor probe ticks to the phase end so stagger actually spreads load - #63
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-raceruns. Existing stagger bounds tests unaffected.Checklist
go build ./... && go vet ./... && go test ./...green with-race(scheduler package; full suite at merge)gofmt -l .cleanFixes #61