Break for unnecessary synchronization

pull/30/head
kompotkot 2021-07-29 01:02:33 +03:00
rodzic c6f50a6f61
commit 048ff0fe23
1 zmienionych plików z 7 dodań i 2 usunięć

Wyświetl plik

@ -9,7 +9,7 @@ from .ethereum import (
crawl_blocks_executor,
crawl_blocks,
check_missing_blocks,
synchronize_latest_blocks,
get_latest_blocks,
)
from .settings import MOONSTREAM_CRAWL_WORKERS
@ -52,9 +52,14 @@ def ethcrawler_blocks_sync_handler(args: argparse.Namespace) -> None:
Synchronize latest Ethereum blocks with database.
"""
while True:
bottom_block_number, top_block_number = synchronize_latest_blocks(
bottom_block_number, top_block_number = get_latest_blocks(
bool(strtobool(args.transactions))
)
if bottom_block_number >= top_block_number:
print(
f"Synchronization is unnecessary for blocks {bottom_block_number}-{top_block_number}"
)
break
for blocks_numbers_list in yield_blocks_numbers_lists(
f"{bottom_block_number}-{top_block_number}"
):