kopia lustrzana https://github.com/bugout-dev/moonstream
Uncomment heartbeat
rodzic
ac2a1c11e3
commit
49ad69e869
|
@ -277,9 +277,9 @@ def handle_historical_crawl(args: argparse.Namespace) -> None:
|
||||||
if args.find_deployed_blocks:
|
if args.find_deployed_blocks:
|
||||||
addresses_set = set()
|
addresses_set = set()
|
||||||
for job in filtered_event_jobs:
|
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:
|
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:
|
if args.start is None:
|
||||||
start_block = web3.eth.blockNumber - 1
|
start_block = web3.eth.blockNumber - 1
|
||||||
|
@ -330,8 +330,8 @@ def handle_historical_crawl(args: argparse.Namespace) -> None:
|
||||||
db_session,
|
db_session,
|
||||||
blockchain_type,
|
blockchain_type,
|
||||||
web3,
|
web3,
|
||||||
filtered_event_jobs,
|
filtered_event_jobs, # type: ignore
|
||||||
filtered_function_call_jobs,
|
filtered_function_call_jobs, # type: ignore
|
||||||
start_block,
|
start_block,
|
||||||
end_block,
|
end_block,
|
||||||
args.max_blocks_batch,
|
args.max_blocks_batch,
|
||||||
|
|
|
@ -162,11 +162,11 @@ def continuous_crawler(
|
||||||
|
|
||||||
logger.info(f"Starting continuous event crawler start_block={start_block}")
|
logger.info(f"Starting continuous event crawler start_block={start_block}")
|
||||||
logger.info("Sending initial heartbeat")
|
logger.info("Sending initial heartbeat")
|
||||||
# heartbeat(
|
heartbeat(
|
||||||
# crawler_type=crawler_type,
|
crawler_type=crawler_type,
|
||||||
# blockchain_type=blockchain_type,
|
blockchain_type=blockchain_type,
|
||||||
# crawler_status=heartbeat_template,
|
crawler_status=heartbeat_template,
|
||||||
# )
|
)
|
||||||
last_heartbeat_time = datetime.utcnow()
|
last_heartbeat_time = datetime.utcnow()
|
||||||
blocks_cache: Dict[int, Optional[int]] = {}
|
blocks_cache: Dict[int, Optional[int]] = {}
|
||||||
current_sleep_time = min_sleep_time
|
current_sleep_time = min_sleep_time
|
||||||
|
@ -276,11 +276,11 @@ def continuous_crawler(
|
||||||
heartbeat_template[
|
heartbeat_template[
|
||||||
"function_call metrics"
|
"function_call metrics"
|
||||||
] = ethereum_state_provider.metrics
|
] = ethereum_state_provider.metrics
|
||||||
# heartbeat(
|
heartbeat(
|
||||||
# crawler_type=crawler_type,
|
crawler_type=crawler_type,
|
||||||
# blockchain_type=blockchain_type,
|
blockchain_type=blockchain_type,
|
||||||
# crawler_status=heartbeat_template,
|
crawler_status=heartbeat_template,
|
||||||
# )
|
)
|
||||||
logger.info("Sending heartbeat.", heartbeat_template)
|
logger.info("Sending heartbeat.", heartbeat_template)
|
||||||
last_heartbeat_time = datetime.utcnow()
|
last_heartbeat_time = datetime.utcnow()
|
||||||
|
|
||||||
|
@ -321,12 +321,12 @@ def continuous_crawler(
|
||||||
"die_reason"
|
"die_reason"
|
||||||
] = f"{e.__class__.__name__}: {e}\n error_summary: {error_summary}\n error_traceback: {error_traceback}"
|
] = f"{e.__class__.__name__}: {e}\n error_summary: {error_summary}\n error_traceback: {error_traceback}"
|
||||||
heartbeat_template["last_block"] = end_block # type: ignore
|
heartbeat_template["last_block"] = end_block # type: ignore
|
||||||
# heartbeat(
|
heartbeat(
|
||||||
# crawler_type=crawler_type,
|
crawler_type=crawler_type,
|
||||||
# blockchain_type=blockchain_type,
|
blockchain_type=blockchain_type,
|
||||||
# crawler_status=heartbeat_template,
|
crawler_status=heartbeat_template,
|
||||||
# is_dead=True,
|
is_dead=True,
|
||||||
# )
|
)
|
||||||
|
|
||||||
logger.exception(e)
|
logger.exception(e)
|
||||||
raise e
|
raise e
|
||||||
|
|
|
@ -261,8 +261,7 @@ def make_event_crawl_jobs(entries: List[BugoutSearchResult]) -> List[EventCrawlJ
|
||||||
crawl_job_by_selector: Dict[str, EventCrawlJob] = {}
|
crawl_job_by_selector: Dict[str, EventCrawlJob] = {}
|
||||||
|
|
||||||
for entry in entries:
|
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"))
|
contract_address = Web3().toChecksumAddress(_get_tag(entry, "address"))
|
||||||
|
|
||||||
entry_id = UUID(entry.entry_url.split("/")[-1]) # crying emoji
|
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
|
entry_id = UUID(entry.entry_url.split("/")[-1]) # crying emoji
|
||||||
contract_address = Web3().toChecksumAddress(_get_tag(entry, "address"))
|
contract_address = Web3().toChecksumAddress(_get_tag(entry, "address"))
|
||||||
abi = json.loads(cast(str, entry.content))
|
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:
|
if method_signature is None:
|
||||||
raise ValueError(f"{abi} is not a function ABI")
|
raise ValueError(f"{abi} is not a function ABI")
|
||||||
|
|
Ładowanie…
Reference in New Issue