Repository navigation
Conversation
Member
|
I'm going to hold off on this for now because the player is currently being refactored in #250. This PR changes the same player update logic that is being moved into I think the idea is worth considering, but I'd prefer to revisit it once the refactor is in a better place. |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Changes
Player._sendUpdate: leading-edge send for the first frame in an idle window, trailing debounce (newest-only) for later frames in the same window, and duplicate suppression when position/connected/ping match the last delivered frame.seek,pause,track,connection,recover), so clients always converge on state changes without delay.Player.flushPlayerUpdate()for explicit convergence (track end, resume flush paths) and_clearPlayerUpdateCoalescer()on destroy so dead players never flush stale frames.queuePlayerUpdatehelper inutils.ts: paused, resumable sessions keep only the newest playerUpdate frame (newest-wins eviction) instead of appending every position; non-resumable sessions drop them.serverMonitor.tsand the clusterplayerUpdateTimerinworkers/main.tsinto two phases (zombie checks, then one update per player), so N players produce at most N frames per tick.Session, worker player, and cluster snapshot types with the coalescer state andflushPlayerUpdate.Why
playerUpdateframe on each state transition plus once per tick, so flappy connections or sponsorblock-heavy tracks produced bursts of near-identical{ position, connected, ping }payloads per player — pure websocket spam.Checkmarks
Additional info
playerUpdateInterval(a quarter of it, clamped to 50-500ms), so operator tuning is respected.