Skip to content

fix(scan): tight 2.5s timeout on cross-network detail probes#59

Merged
github-actions[bot] merged 2 commits into
mainfrom
fix/scan-cross-network-probe-timeout
May 11, 2026
Merged

fix(scan): tight 2.5s timeout on cross-network detail probes#59
github-actions[bot] merged 2 commits into
mainfrom
fix/scan-cross-network-probe-timeout

Conversation

@satyakwok
Copy link
Copy Markdown
Member

Summary

Block / tx / token detail pages each fire a parallel cross-network side-probe so a user who pasted (say) a testnet hash on the mainnet domain gets auto-switched to the right network. Pre-fix the side-probe inherited the `apiFetch` default 8 s timeout, so when the peer network was unreachable (testnet outage on 2026-05-11) the primary detail page sat on a not-found wall for 8 s waiting on the dead peer.

Fix

Plumbed an optional `timeoutMs` through:

Function File
`fetchBlock(network, height, timeoutMs?)` `api.ts`
`fetchTransaction(network, txId, timeoutMs?)` `api.ts`
`fetchToken(network, address, timeoutMs?)` `api.ts`
`useBlock(network, height, timeoutMs?)` `hooks.ts`
`useTransaction(network, hash, timeoutMs?)` `hooks.ts`

Side-probe call sites passed `2500`:

  • `blocks/[height]/page.tsx` → `useBlock(other, h, 2500)`
  • `tx/[hash]/page.tsx` → `useTransaction(other, h, 2500)`
  • `tokens/[addr]/page.tsx` → `fetchToken(other, addr, 2500)`

Primary fetches keep the 8 s default. Worst-case page render is now 2.5 s when the peer is down (was 8 s).

Verification

  • `pnpm --filter @sentriscloud/scan typecheck` clean
  • Live retest after deploy: kill testnet upstream, paste a mainnet block id, page renders within ~3 s instead of ~8 s

Test plan

  • CI green
  • On healthy peer: cross-network indicator still appears (probe completes within 2.5 s)
  • On dead peer: page renders within ~3 s, side-probe gracefully reports null

satyakwok added 2 commits May 11, 2026 03:26
V1 scan README + both env files referenced subdomains that no longer
resolve (sentrixscan.sentriscloud.com, testnet-scan.sentriscloud.com,
sentrix-rpc.sentriscloud.com, sentrix-api.sentriscloud.com — all 000
on probe). Same drift in apps/landing/.env.example.

Canonical subdomains (per probe + memory project_chain_naming_canonical):

  V1 scan mainnet : scan.sentrixchain.com
  V1 scan testnet : scan-testnet.sentrixchain.com
  V2 scan mainnet : scan.sentriscloud.com
  V2 scan testnet : scan-testnet.sentriscloud.com
  RPC mainnet     : rpc.sentrixchain.com (bare, no /rpc suffix)
  RPC testnet     : testnet-rpc.sentrixchain.com (bare)
  REST mainnet    : api.sentrixchain.com
  REST testnet    : testnet-api.sentrixchain.com

Also fixes the V1 README "Deploy" section: it claimed nginx + ports
3006/3007 (one process per network), reality is single Caddy upstream
on port 3005 serving both subdomains.
Block / tx / token detail pages fire a parallel "is this same id also
on the other chain?" side-probe so a user who pasted (e.g.) a testnet
hash on the mainnet domain gets auto-switched. Pre-fix the side-probe
inherited the apiFetch default 8s timeout, so when the peer network
was unreachable (testnet outage 2026-05-11) the primary detail page
sat on a not-found wall for 8s waiting on the dead peer.

Plumbed an optional timeoutMs parameter through:

  fetchBlock(network, height, timeoutMs?)         api.ts
  fetchTransaction(network, txId, timeoutMs?)     api.ts
  fetchToken(network, address, timeoutMs?)        api.ts
  useBlock(network, height, timeoutMs?)           hooks.ts
  useTransaction(network, hash, timeoutMs?)       hooks.ts

Side-probe call sites updated:

  blocks/[height]/page.tsx  → useBlock(other, h, 2500)
  tx/[hash]/page.tsx        → useTransaction(other, h, 2500)
  tokens/[addr]/page.tsx    → fetchToken(other, addr, 2500)

Primary fetches keep the 8s default. Worst-case page render now
2.5s when peer is down vs. 8s.

Typecheck clean.
@github-actions github-actions Bot enabled auto-merge (squash) May 11, 2026 01:30
@github-actions github-actions Bot merged commit e4d5596 into main May 11, 2026
5 checks passed
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