Skip to content

Commit 956c77f

Browse files
committed
Merge branch 'main' into multiple-providers
2 parents 13d7529 + 987ba9e commit 956c77f

File tree

5 files changed

+23
-24
lines changed

5 files changed

+23
-24
lines changed

src/event_scanner/scanner/historic.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,6 @@ use crate::{
77
};
88

99
impl EventScannerBuilder<Historic> {
10-
#[must_use]
11-
pub fn max_block_range(mut self, max_block_range: u64) -> Self {
12-
self.block_range_scanner.max_block_range = max_block_range;
13-
self
14-
}
15-
1610
#[must_use]
1711
pub fn from_block(mut self, block: impl Into<BlockNumberOrTag>) -> Self {
1812
self.config.from_block = block.into();

src/event_scanner/scanner/latest.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,6 @@ use crate::{
77
};
88

99
impl EventScannerBuilder<LatestEvents> {
10-
#[must_use]
11-
pub fn max_block_range(mut self, max_block_range: u64) -> Self {
12-
self.block_range_scanner.max_block_range = max_block_range;
13-
self
14-
}
15-
1610
#[must_use]
1711
pub fn block_confirmations(mut self, confirmations: u64) -> Self {
1812
self.config.block_confirmations = confirmations;

src/event_scanner/scanner/live.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,6 @@ use crate::{
77
};
88

99
impl EventScannerBuilder<Live> {
10-
#[must_use]
11-
pub fn max_block_range(mut self, max_block_range: u64) -> Self {
12-
self.block_range_scanner.max_block_range = max_block_range;
13-
self
14-
}
15-
1610
#[must_use]
1711
pub fn block_confirmations(mut self, confirmations: u64) -> Self {
1812
self.config.block_confirmations = confirmations;

src/event_scanner/scanner/mod.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,29 @@ impl EventScannerBuilder<SyncFromBlock> {
363363
}
364364

365365
impl<M> EventScannerBuilder<M> {
366+
/// Sets the maximum block range per event batch.
367+
///
368+
/// Controls how the scanner splits a large block range into smaller batches for processing.
369+
/// Each batch corresponds to a single RPC call to fetch logs. This prevents timeouts and
370+
/// respects rate limits imposed by node providers.
371+
///
372+
/// # Arguments
373+
///
374+
/// * `max_block_range` - Maximum number of blocks to process per batch.
375+
///
376+
/// # Example
377+
///
378+
/// If scanning events from blocks 1000–1099 (100 blocks total) with `max_block_range(30)`:
379+
/// - Batch 1: blocks 1000–1029 (30 blocks)
380+
/// - Batch 2: blocks 1030–1059 (30 blocks)
381+
/// - Batch 3: blocks 1060–1089 (30 blocks)
382+
/// - Batch 4: blocks 1090–1099 (10 blocks)
383+
#[must_use]
384+
pub fn max_block_range(mut self, max_block_range: u64) -> Self {
385+
self.block_range_scanner.max_block_range = max_block_range;
386+
self
387+
}
388+
366389
/// Connects to an existing provider.
367390
///
368391
/// Final builder method: consumes the builder and returns the built [`EventScanner`].

src/event_scanner/scanner/sync/from_block.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,6 @@ use crate::{
99
};
1010

1111
impl EventScannerBuilder<SyncFromBlock> {
12-
#[must_use]
13-
pub fn max_block_range(mut self, max_block_range: u64) -> Self {
14-
self.block_range_scanner.max_block_range = max_block_range;
15-
self
16-
}
17-
1812
#[must_use]
1913
pub fn block_confirmations(mut self, confirmations: u64) -> Self {
2014
self.config.block_confirmations = confirmations;

0 commit comments

Comments
 (0)