fix(indexer): resume by ledger instead of sending the cursor as a paging token#193
Merged
Conversation
… paging token poll_once persisted the last processed *ledger sequence* as its cursor but, on every poll after the first, passed that number to the Soroban getEvents RPC in the *paging-token* cursor field — which the RPC rejects as an invalid cursor, stalling ingestion. It also read start_ledger on every loop iteration, so page 2+ of any poll sent startLedger AND cursor together, which are mutually exclusive in the RPC. Extract the page-request decision into a pure page_request_params(): - later pages -> paging token only - fresh index -> startLedger 1 - resume -> startLedger = cursor + 1 (never re-scan, never mix) Add pure unit tests (no DB/Redis) that would have caught both faults; these run in the plain rust job, not just integration.
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.
Part of the hardening sweep (item B1).
poll_oncepersisted the last processed ledger sequence as its cursor but, on every poll after the first, passed that number to the SorobangetEventsRPC in the paging-tokencursorfield — which the RPC rejects as an invalid cursor, stalling ingestion after the first poll/restart. It also readstart_ledgeron every loop iteration, so pages 2+ of any poll sentstartLedgerandcursortogether (mutually exclusive in the RPC).Fix: extract the page-request decision into a pure
page_request_params():startLedger = 1startLedger = cursor + 1(never re-scan, never mix the two)Added pure unit tests (no DB/Redis) that would have caught both faults — they run in the plain
rustjob as well as integration.