fix: don't let the batch event scan block the status display - #24
Open
sainathr19 wants to merge 1 commit into
Open
fix: don't let the batch event scan block the status display#24sainathr19 wants to merge 1 commit into
sainathr19 wants to merge 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
refresh()awaitedfetchStatusandfetchBatchestogether viaPromise.all.fetchBatchesscansfrom_block=0to"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,setStatusnever ran, so the UI stayed blank (dashes for current interval / next to execute) even thoughfetchStatusitself resolves instantly.nextFromBlockRefnever advanced to unblock it — compounding request volume against the public RPC over time.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 buildsucceeds