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 @@ -366,6 +366,29 @@ impl EventScannerBuilder<SyncFromBlock> {
366366}
367367
368368impl < M > EventScannerBuilder < M > {
369+ /// Sets the maximum block range per event batch.
370+ ///
371+ /// Controls how the scanner splits a large block range into smaller batches for processing.
372+ /// Each batch corresponds to a single RPC call to fetch logs. This prevents timeouts and
373+ /// respects rate limits imposed by node providers.
374+ ///
375+ /// # Arguments
376+ ///
377+ /// * `max_block_range` - Maximum number of blocks to process per batch.
378+ ///
379+ /// # Example
380+ ///
381+ /// If scanning events from blocks 1000–1099 (100 blocks total) with `max_block_range(30)`:
382+ /// - Batch 1: blocks 1000–1029 (30 blocks)
383+ /// - Batch 2: blocks 1030–1059 (30 blocks)
384+ /// - Batch 3: blocks 1060–1089 (30 blocks)
385+ /// - Batch 4: blocks 1090–1099 (10 blocks)
386+ #[ must_use]
387+ pub fn max_block_range ( mut self , max_block_range : u64 ) -> Self {
388+ self . block_range_scanner . max_block_range = max_block_range;
389+ self
390+ }
391+
369392 /// Connects to the provider via WebSocket.
370393 ///
371394 /// 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 , count : u64 ) -> Self {
2014 self . config . block_confirmations = count;
You can’t perform that action at this time.
0 commit comments