Repository navigation
Follow the spec's time sync burst rules - #194
Merged
Merged
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
Static review found no blocking issues; the remaining regression-test suggestion is optional.
1 open issue
What changed in this PR
Aligns the SDK’s time synchronization bursts with the protocol’s sample-selection and timing rules.
Changes:
- Selects the lowest-RTT sample instead of the median of the three fastest samples.
- Truncates offset and maximum error to whole microseconds.
- Reduces the burst interval to 9 seconds and updates selection and scheduling tests.
| File | Description |
|---|---|
| tests/unit/time-sync-manager.test.ts | Updates expectations for sample selection and burst timing. |
| src/core/time-sync-manager.ts | Revises sample selection, microsecond truncation, and burst interval. |
Review effort: Balanced
33 tasks done
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 does this implement/fix?
The client didn't follow the spec's rules for
client/timebursts. It fed the time filter the median of the three fastest measurements instead of the one with the lowestmax_error, and bursts always started slightly more than 10 seconds apart.Now each burst only feeds its lowest
max_errormeasurement to the filter,measurementandmax_errorare truncated to whole microseconds, and bursts are scheduled every 9 seconds so a late timer can't push them past the 10 second limit.Bursts can still end up more than 10 seconds apart when the previous burst is still running at the next tick (round trips averaging over about 1.1 s), or when Chrome throttles timers in a tab that has been hidden and silent for a while. Servers must not close the connection over this.
Related issue or spec PR (if applicable):
Types of changes
bugfixnew-featureenhancementbreaking-changerefactordocumentationmaintenancecidependencies