Skip to content

Conversation

@zy0n
Copy link
Contributor

@zy0n zy0n commented Jan 16, 2026

This pull request refactors and improves the event polling logic in the provider implementation. The main focus is on making event polling more efficient, robust, and easier to manage by introducing batching, error handling, and improved timer management.

Event Polling Efficiency and Batching

  • The BatchedPollingEventSubscriber now batches eth_getLogs calls, processing events in chunks of up to 500 blocks (DEFAULT_MAX_BATCH_BLOCKS). This reduces the number of RPC calls and improves performance for large block ranges. [1] [2]

Robustness and Error Handling

  • Added exponential backoff on polling errors and emits errors via the provider instead of just logging. This helps prevent rapid retry loops and surfaces errors to subscribers.
  • Ensured that only one poll is scheduled at a time by tracking polling state and clearing timers before scheduling new ones, preventing overlapping polls and potential race conditions.

Integration and Pause Support

  • When creating a new BatchedPollingEventSubscriber in PollingJsonRpcProvider, the subscriber respects the provider's paused state and can be paused immediately if required.

@zy0n zy0n requested a review from bhflm January 16, 2026 21:52
@zy0n zy0n merged commit e8c8e90 into main Jan 16, 2026
5 of 6 checks passed
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.

3 participants