diff options
| author | Adam Soltys <[email protected]> | 2026-06-24 23:23:50 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-06-24 23:23:50 -0700 |
| commit | 7af3c430d49d7817e9a0cf28ab49143edba4c00f (patch) | |
| tree | 33843b3dde033b0506db84d689906967ca9812b2 /src/app.js | |
| parent | 4d1a9aea0f6b234dfe8eb36d398002ccea6a5680 (diff) | |
| download | coinosv3-7af3c430d49d7817e9a0cf28ab49143edba4c00f.tar.gz coinosv3-7af3c430d49d7817e9a0cf28ab49143edba4c00f.zip | |
Make pending receives fast: cut REST load, surface live/polling state
Incoming deposits show instantly when the mempool.space WebSocket is healthy
(_ingestWs updates immediately). The lag came from the socket being starved:
a 20s frontier poll plus a full wallet re-scan every 120s generated enough
REST volume to trip mempool's per-IP rate limit (the 429/CORS errors), which
in turn degraded the socket — a feedback loop.
- While the socket is live, skip the periodic full scan entirely (the WS pushes
confirmations and block events) and poll the frontier only every ~25s as a
half-open-socket safety net — near-zero recurring REST.
- While the socket is down, poll the frontier every ~6s (was 20s) so receives
still show quickly, and keep the 120s reconcile scan.
- Refresh the frontier on WS (re)connect to catch deposits that landed while
disconnected.
- Surface a Live/Polling badge on the balance card so a stuck socket is visible.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Diffstat (limited to 'src/app.js')
| -rw-r--r-- | src/app.js | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -1582,7 +1582,14 @@ function balanceCard() { return h( 'div', { class: 'card balance' }, - h('div', { class: 'small faint', style: 'text-transform:uppercase;letter-spacing:.05em' }, t('balance')), + h('div', { class: 'row between', style: 'align-items:center' }, + h('div', { class: 'small faint', style: 'text-transform:uppercase;letter-spacing:.05em' }, t('balance')), + // Live = receiving instant WebSocket pushes; otherwise we're polling, so + // deposits can lag a few seconds. Surfaced so a stuck socket is visible. + wallet.offline ? null + : h('span', { class: 'badge ' + (wallet.live ? 'live' : 'off') + ' dot', style: 'font-size:11px;padding:2px 8px' }, + wallet.live ? t('liveTag') : t('pollingTag')) + ), // Headline is the spendable balance: confirmed coins plus our own pending // change, minus gift locks — so a pending spend debits immediately, while a // pending incoming receive stays out of it until it confirms. |
