Skip to content

Commit d4beb08

Browse files
committed
Add chunk comments
1 parent ad56201 commit d4beb08

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

sw_utils/event_scanner.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,11 @@ def __init__(
5858
self._contract_call = lambda from_block, to_block: getattr(
5959
processor.contract.events, processor.contract_event
6060
).get_logs(argument_filters=argument_filters, fromBlock=from_block, toBlock=to_block)
61-
# Scan in chunks, commit between
62-
self.chunk_size = chunk_size or self.max_scan_chunk_size // 2
61+
62+
# Start with half or max chunk size. 1kk chunks works only with powerful nodes.
63+
start_chunk_size = self.max_scan_chunk_size // 2
64+
# Scan in chunks, commit between.
65+
self.chunk_size = chunk_size or start_chunk_size
6366

6467
async def process_new_events(self, to_block: BlockNumber) -> None:
6568
current_from_block = await self.processor.get_from_block()

0 commit comments

Comments
 (0)