Skip to content

fix: don't let the batch event scan block the status display - #24

Open
sainathr19 wants to merge 1 commit into
azeemshaik025:mainfrom
sainathr19:fix/batch-scan-blocks-status
Open

fix: don't let the batch event scan block the status display#24
sainathr19 wants to merge 1 commit into
azeemshaik025:mainfrom
sainathr19:fix/batch-scan-blocks-status

Conversation

@sainathr19

Copy link
Copy Markdown
Collaborator

Summary

  • refresh() awaited fetchStatus and fetchBatches together via Promise.all. fetchBatches scans from_block=0 to "latest" on its first call — against a contract deployed near the chain's current tip, that's a huge paginated range with zero matching events yet, taking many RPC round-trips to exhaust. While that scan was in flight, setStatus never ran, so the UI stayed blank (dashes for current interval / next to execute) even though fetchStatus itself resolves instantly.
  • The 10s poll interval also kept starting a new overlapping scan on top of the still-running one, since nextFromBlockRef never advanced to unblock it — compounding request volume against the public RPC over time.
  • Decouples the batch scan from status/plan updates, and adds an in-flight guard so a slow scan can't be restarted from under itself by the next poll tick.

Found live-debugging the mainnet-deployed UI: RPC and contract were both confirmed healthy via direct calls, but the dashboard stayed blank. Traced via network request logs (336+ requests to the RPC and climbing) to this scan.

Test plan

  • npm run build succeeds
  • Verified in browser against the live mainnet deployment: status numbers (current interval, next to execute, batch size) now populate immediately instead of staying blank

refresh() awaited fetchStatus and fetchBatches together via Promise.all.
fetchBatches scans from_block=0 to "latest" on its first call — against a
contract deployed near the chain's current tip, that's a huge paginated
range with zero matching events, taking many RPC round-trips to exhaust.
While it was in flight, setStatus never ran, so the UI stayed blank even
though fetchStatus itself resolves instantly. The 10s poll interval also
kept starting a fresh overlapping scan on top of the still-running one.

Decouple the batch scan from status/plan, and guard it so a slow scan
can't be restarted by the next poll tick before it finishes.
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