File tree Expand file tree Collapse file tree 5 files changed +23
-24
lines changed
src/event_scanner/scanner Expand file tree Collapse file tree 5 files changed +23
-24
lines changed Original file line number Diff line number Diff line change @@ -7,12 +7,6 @@ use crate::{
77} ;
88
99impl 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 ( ) ;
Original file line number Diff line number Diff line change @@ -7,12 +7,6 @@ use crate::{
77} ;
88
99impl 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;
Original file line number Diff line number Diff line change @@ -7,12 +7,6 @@ use crate::{
77} ;
88
99impl 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;
Original file line number Diff line number Diff line change @@ -363,6 +363,29 @@ impl EventScannerBuilder<SyncFromBlock> {
363363}
364364
365365impl < 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`].
Original file line number Diff line number Diff line change @@ -9,12 +9,6 @@ use crate::{
99} ;
1010
1111impl 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;
You can’t perform that action at this time.
0 commit comments