Skip to content

Commit

Permalink
Add chunk comments
Browse files Browse the repository at this point in the history
  • Loading branch information
cyc60 committed Nov 18, 2024
1 parent ad56201 commit d4beb08
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions sw_utils/event_scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,11 @@ def __init__(
self._contract_call = lambda from_block, to_block: getattr(
processor.contract.events, processor.contract_event
).get_logs(argument_filters=argument_filters, fromBlock=from_block, toBlock=to_block)
# Scan in chunks, commit between
self.chunk_size = chunk_size or self.max_scan_chunk_size // 2

# Start with half or max chunk size. 1kk chunks works only with powerful nodes.
start_chunk_size = self.max_scan_chunk_size // 2
# Scan in chunks, commit between.
self.chunk_size = chunk_size or start_chunk_size

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

0 comments on commit d4beb08

Please sign in to comment.