What
getLatestLedger has no try/catch; a network error propagates to the outer catch which logs and sleeps for a fixed pollIntervalMs (5s). If the RPC is down for hours, the indexer hammers it every 5 seconds with no exponential backoff. Similarly, fetchContractEvents catches RPC errors and returns an empty array — no retry within the same cycle.
Why
A single failed RPC call wastes the entire cycle for that contract. No circuit breaker exists to pause requests during prolonged outages.
Scope
- Add exponential backoff for RPC failures
- Implement a circuit breaker pattern
- Retry failed RPC calls within the same cycle
Acceptance Criteria
Technical Context
- File:
src/indexer/event-listener.ts, lines 115-119, 128-131
- Consider using the
cockatiel library (already used in chainlearn-api)
What
getLatestLedgerhas no try/catch; a network error propagates to the outer catch which logs and sleeps for a fixedpollIntervalMs(5s). If the RPC is down for hours, the indexer hammers it every 5 seconds with no exponential backoff. Similarly,fetchContractEventscatches RPC errors and returns an empty array — no retry within the same cycle.Why
A single failed RPC call wastes the entire cycle for that contract. No circuit breaker exists to pause requests during prolonged outages.
Scope
Acceptance Criteria
Technical Context
src/indexer/event-listener.ts, lines 115-119, 128-131cockatiellibrary (already used in chainlearn-api)