fix(gamebanners): anchor ticker to data.last_update, not Date.now() - #9
Merged
Merged
Conversation
The 1Hz ticker was using the browser fetch-receipt time as the baseline for round_duration interpolation, but the JSON file it's reading is up to one poll-interval stale by the time it arrives — serverinfo-updater rewrites it every 4s, the browser can fetch it at any phase of that window. Result: the displayed clock drifted 0-4s behind real time, and snapped forward on each subsequent fetch. Now uses payload.last_update (the wall-clock the serverinfo-updater container stamped on the file when it was written) as the ticker anchor. The displayed round_duration now equals the value at write time plus (now - write_time), which is the real round duration. pickBaselineTime() guards against a wildly skewed browser clock (NTP failure, user clock wrong by hours): if last_update is more than 5 minutes from Date.now(), we fall back to Date.now() so the ticker doesn't compute a multi-minute jump. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
The 1Hz local ticker was using browser fetch-receipt time as the
baseline for
round_durationinterpolation. But the JSON file is upto one poll-interval stale by the time it arrives — the
serverinfo-updaterrewrites it every 4s and the browser can fetchat any phase of that window. So the displayed clock drifted 0-4s
behind real time, and visibly snapped forward on each fetch.
This switches the ticker baseline to
payload.last_update(thewall-clock the producer stamped on the file when it was written).
Displayed
round_durationis nowvalue_at_write_time + (now - write_time),which is the real, current round duration.
Edge cases
pickBaselineTimefalls back toDate.now()whenlast_updateis missing or > 5 minutes off the browser clock. Without the guard,
a wildly-skewed user clock would surface as a multi-minute timer
jump.
setUnavailable/setNetworkErrorpaths still clear_statusData,so the ticker can't drift over stale data while disconnected.
Companion
ReduxStation/ReduxStation#114— flipsgame_versionfrom"/tg/ Station 13"to
"ReduxStation". Lands when the game redeploys.After merge