Skip to content

fix(indexer): resume by ledger instead of sending the cursor as a paging token#193

Merged
Depo-dev merged 1 commit into
mainfrom
fix/indexer-resume-cursor
Jul 3, 2026
Merged

fix(indexer): resume by ledger instead of sending the cursor as a paging token#193
Depo-dev merged 1 commit into
mainfrom
fix/indexer-resume-cursor

Conversation

@Depo-dev

@Depo-dev Depo-dev commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

Part of the hardening sweep (item B1).

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 after the first poll/restart. It also read start_ledger on every loop iteration, so pages 2+ of any poll sent startLedger and cursor together (mutually exclusive in the RPC).

Fix: 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 the two)

Added pure unit tests (no DB/Redis) that would have caught both faults — they run in the plain rust job as well as integration.

… 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.
@Depo-dev Depo-dev merged commit 1bea4c2 into main Jul 3, 2026
8 checks passed
@Depo-dev Depo-dev deleted the fix/indexer-resume-cursor branch July 3, 2026 17:23
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