Uncomment heartbeat

pull/924/head
Andrey 2023-10-12 14:11:19 +03:00
rodzic ac2a1c11e3
commit 49ad69e869
3 zmienionych plików z 22 dodań i 24 usunięć

Wyświetl plik

@ -277,9 +277,9 @@ def handle_historical_crawl(args: argparse.Namespace) -> None:
if args.find_deployed_blocks:
addresses_set = set()
for job in filtered_event_jobs:
addresses_set.update(job.contracts)
addresses_set.update(job.contracts) # type: ignore
for function_job in filtered_function_call_jobs:
addresses_set.add(function_job.contract_address)
addresses_set.add(function_job.contract_address) # type: ignore
if args.start is None:
start_block = web3.eth.blockNumber - 1
@ -330,8 +330,8 @@ def handle_historical_crawl(args: argparse.Namespace) -> None:
db_session,
blockchain_type,
web3,
filtered_event_jobs,
filtered_function_call_jobs,
filtered_event_jobs, # type: ignore
filtered_function_call_jobs, # type: ignore
start_block,
end_block,
args.max_blocks_batch,

Wyświetl plik

@ -162,11 +162,11 @@ def continuous_crawler(
logger.info(f"Starting continuous event crawler start_block={start_block}")
logger.info("Sending initial heartbeat")
# heartbeat(
# crawler_type=crawler_type,
# blockchain_type=blockchain_type,
# crawler_status=heartbeat_template,
# )
heartbeat(
crawler_type=crawler_type,
blockchain_type=blockchain_type,
crawler_status=heartbeat_template,
)
last_heartbeat_time = datetime.utcnow()
blocks_cache: Dict[int, Optional[int]] = {}
current_sleep_time = min_sleep_time
@ -276,11 +276,11 @@ def continuous_crawler(
heartbeat_template[
"function_call metrics"
] = ethereum_state_provider.metrics
# heartbeat(
# crawler_type=crawler_type,
# blockchain_type=blockchain_type,
# crawler_status=heartbeat_template,
# )
heartbeat(
crawler_type=crawler_type,
blockchain_type=blockchain_type,
crawler_status=heartbeat_template,
)
logger.info("Sending heartbeat.", heartbeat_template)
last_heartbeat_time = datetime.utcnow()
@ -321,12 +321,12 @@ def continuous_crawler(
"die_reason"
] = f"{e.__class__.__name__}: {e}\n error_summary: {error_summary}\n error_traceback: {error_traceback}"
heartbeat_template["last_block"] = end_block # type: ignore
# heartbeat(
# crawler_type=crawler_type,
# blockchain_type=blockchain_type,
# crawler_status=heartbeat_template,
# is_dead=True,
# )
heartbeat(
crawler_type=crawler_type,
blockchain_type=blockchain_type,
crawler_status=heartbeat_template,
is_dead=True,
)
logger.exception(e)
raise e

Wyświetl plik

@ -261,8 +261,7 @@ def make_event_crawl_jobs(entries: List[BugoutSearchResult]) -> List[EventCrawlJ
crawl_job_by_selector: Dict[str, EventCrawlJob] = {}
for entry in entries:
abi_selector = _get_tag(entry, "abi_method_hash")
# abi_selector = _get_tag(entry, "abi_selector")
abi_selector = _get_tag(entry, "abi_selector")
contract_address = Web3().toChecksumAddress(_get_tag(entry, "address"))
entry_id = UUID(entry.entry_url.split("/")[-1]) # crying emoji
@ -303,8 +302,7 @@ def make_function_call_crawl_jobs(
entry_id = UUID(entry.entry_url.split("/")[-1]) # crying emoji
contract_address = Web3().toChecksumAddress(_get_tag(entry, "address"))
abi = json.loads(cast(str, entry.content))
method_signature = encode_function_signature(abi)
# method_signature = _get_tag(entry, "abi_selector")
method_signature = _get_tag(entry, "abi_selector")
if method_signature is None:
raise ValueError(f"{abi} is not a function ABI")