Skip to content

fix(gamebanners): anchor ticker to data.last_update, not Date.now() - #9

Merged
s950tx16wasr10 merged 1 commit into
masterfrom
fix/ticker-anchor-last-update
May 18, 2026
Merged

fix(gamebanners): anchor ticker to data.last_update, not Date.now()#9
s950tx16wasr10 merged 1 commit into
masterfrom
fix/ticker-anchor-last-update

Conversation

@s950tx16wasr10

Copy link
Copy Markdown
Contributor

What

The 1Hz local ticker was using browser fetch-receipt time as the
baseline for round_duration interpolation. But the JSON file is up
to one poll-interval stale by the time it arrives — the
serverinfo-updater rewrites it every 4s and the browser can fetch
at 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 (the
wall-clock the producer stamped on the file when it was written).
Displayed round_duration is now value_at_write_time + (now - write_time),
which is the real, current round duration.

Edge cases

  • pickBaselineTime falls back to Date.now() when last_update
    is 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 / setNetworkError paths still clear _statusData,
    so the ticker can't drift over stale data while disconnected.

Companion

ReduxStation/ReduxStation#114 — flips game_version from "/tg/ Station 13"
to "ReduxStation". Lands when the game redeploys.

After merge

docker compose build --no-cache website-builder
docker compose up website-builder

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>
@s950tx16wasr10
s950tx16wasr10 merged commit c986aaa into master May 18, 2026
1 check passed
@s950tx16wasr10
s950tx16wasr10 deleted the fix/ticker-anchor-last-update branch May 18, 2026 16:47
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.

1 participant