fix(indexer): decay idle token/trader windows and flag stale overview (#577) #1099

Merged
PlasticDigits merged 2 commits from fix/577-rollup-decay into main 2026-08-20 03:20:44 +00:00
PlasticDigits commented 2026-08-20 01:53:00 +00:00 (Migrated from gitlab.com)

Summary

  • Token token_volume_stats and trader volume_24h / 7d / 30d now zero when swap_events leave the trailing cutoff (same pattern as idle pair_volume_24h).
  • Indexer startup refreshes token + trader + pair + global windows immediately (refresh_all_volume_windows), not after the 5 min loop sleep.
  • /overview still serves global_stats_24h on GET. If updated_at is older than 15 minutes, the indexer logs a warning and does not live-scan 30d swap_events (V5 / #281 / #333).

Closes #577

Test plan

  • make verify-issue-577 (Postgres + indexer/.env; no wasm deploy)
  • Asset with only 25h-old offer swaps: GET /api/v1/tokens/{addr} volume_stats window 24h is 0; 7d still counts
  • Trader last swap 31d ago: rolling volumes 0; total_volume / total_volume_usd unchanged
  • Pair with only 48h swaps: pair_volume_24h.volume_quote = 0; sort=volume_24h does not rank it as live
  • Age previously counted 24h swaps to 25h and refresh: global_stats_24h trades/volume decrease (to 0 if none remain)
  • Operator: SELECT updated_at FROM global_stats_24h WHERE id = 1 advances on a running indexer; age > 15 min produces the stale rollup tracing warning
  • Restart indexer: token + trader windows refresh without waiting 5 min
  • Charts copy (#576) still separate — live trailing window may still show a non-zero 24h USD; it must not stay frozen after idle decay
## Summary - Token `token_volume_stats` and trader `volume_24h` / `7d` / `30d` now **zero** when `swap_events` leave the trailing cutoff (same pattern as idle `pair_volume_24h`). - Indexer startup refreshes token + trader + pair + global windows immediately (`refresh_all_volume_windows`), not after the 5 min loop sleep. - `/overview` still serves `global_stats_24h` on GET. If `updated_at` is older than **15 minutes**, the indexer logs a warning and does **not** live-scan 30d `swap_events` (V5 / #281 / #333). Closes #577 ## Test plan - [ ] `make verify-issue-577` (Postgres + `indexer/.env`; no wasm deploy) - [ ] Asset with only 25h-old offer swaps: `GET /api/v1/tokens/{addr}` `volume_stats` window `24h` is 0; `7d` still counts - [ ] Trader last swap 31d ago: rolling volumes 0; `total_volume` / `total_volume_usd` unchanged - [ ] Pair with only 48h swaps: `pair_volume_24h.volume_quote = 0`; `sort=volume_24h` does not rank it as live - [ ] Age previously counted 24h swaps to 25h and refresh: `global_stats_24h` trades/volume **decrease** (to 0 if none remain) - [ ] Operator: `SELECT updated_at FROM global_stats_24h WHERE id = 1` advances on a running indexer; age > 15 min produces the stale rollup tracing warning - [ ] Restart indexer: token + trader windows refresh without waiting 5 min - [ ] Charts copy (#576) still separate — live trailing window may still show a non-zero 24h USD; it must not stay **frozen** after idle decay
PlasticDigits commented 2026-08-20 03:20:38 +00:00 (Migrated from gitlab.com)

added 16 commits

  • 26a2714e...a30edba3 - 15 commits from branch main
  • 39c6cb38 - Merge origin/main into fix/577-rollup-decay.

Compare with previous version

added 16 commits <ul><li>26a2714e...a30edba3 - 15 commits from branch <code>main</code></li><li>39c6cb38 - Merge origin/main into fix/577-rollup-decay.</li></ul> [Compare with previous version](/PlasticDigits/cl8y-dex-terraclassic/-/merge_requests/381/diffs?diff_id=1972532311&start_sha=26a2714e70a965a8e9ccbbca29931b09f13a51d1)
PlasticDigits commented 2026-08-20 03:20:44 +00:00 (Migrated from gitlab.com)

mentioned in commit 704e5b9793

mentioned in commit 704e5b97938a7fad8f9e8fb96d087b2c744c16a8
PlasticDigits (Migrated from gitlab.com) merged commit 704e5b9793 into main 2026-08-20 03:20:44 +00:00
PlasticDigits commented 2026-08-20 03:54:14 +00:00 (Migrated from gitlab.com)

mentioned in issue #576

mentioned in issue #576
PlasticDigits commented 2026-08-20 03:54:21 +00:00 (Migrated from gitlab.com)

mentioned in issue #577

mentioned in issue #577
PlasticDigits commented 2026-08-20 03:54:52 +00:00 (Migrated from gitlab.com)

mentioned in issue #583

mentioned in issue #583
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
code/cl8y-dex-terraclassic!1099
No description provided.