Skip to main content
← Back to list
01Issue
FeatureShippedExtensions
Assigneeskeeb

Relationships

#1055 Serve leaderboard live from the score_daily rollup — retire per-pod snapshot & campaign-blind board fallback

Opened by keeb · 7/9/2026· Shipped 7/9/2026

Problem

The four leaderboard boards are served from a per-pod in-memory snapshot (lib/app/leaderboard-snapshot.ts, #834), rebuilt ~every 60s per pod. Two problems that fight the "see it immediately, everywhere" requirement:

  • Per-pod divergence. Each replica holds its own snapshot on its own clock, so refreshing the page can show a different board depending on which pod answers (drift bounded to one TTL, but visible).
  • Up-to-60s staleness. A just-landed grant — a badge worth a million points, a tier-crossing — doesn't appear until that pod's next rebuild, even though the underlying read is now instant. This breaks the celebration loop: a Discord "you just earned X" announcement should be reflected on the site immediately, on every pod, the moment the user clicks through.

Board reads are also wrapped in a Mongo fallback (lib/app/score-read-fallback.ts) that, on any ClickHouse hiccup, serves the legacy campaign-blind engine — the original source of the double-XP 1x/2x flicker. A board should never silently serve divergent amounts.

Proposed solution

Board reads are now cheap (the score_daily rollup, PR #860 — no full-ledger FINAL). Read the rollup live per request and retire the per-pod snapshot:

  • ClickHouse becomes the single shared source every pod reads → divergence gone, freshness instant, no frozen copy re-staling an instant read.
  • Preserve pagination consistency with an asOf timestamp threaded from the client (any pod deterministically reproduces the same frozen view), replacing the snapshot version pin — so "the board can't shift while you scroll" holds without a per-pod blob.
  • Remove the campaign-blind Mongo engine from the board path: on a CH outage, serve last-good or a clean degradation, never divergent numbers.

Alternatives

  • Interim, no code: drop LEADERBOARD_SNAPSHOT_TTL_MS (default 60s) to ~5s now that reads are cheap — shrinks staleness and per-pod divergence to seconds without touching islands/routes. Fully reversible.
  • Shared snapshot instead of live: keep a snapshot but move it single-writer → shared store instead of per-pod. Fixes divergence but not the frozen staleness, and adds coordination moving parts.

Depends on: PR #860 (score_daily rollup) merged + deployed.

02Bog Flow
OPENTRIAGEDIN PROGRESSSHIPPED+ 1 MOREASSIGNED+ 5 MOREREVIEW+ 6 MOREPR_MERGED+ 1 MORENOTIFICATION_SKIPPED

Shipped

7/9/2026, 11:57:51 PM

Click a lifecycle step above to view its details.

03Sludge Pulse
keeb assigned keeb7/9/2026, 10:27:08 PM

Sign in to post a ripple.