From acd8b27effcaaa24ee3abf96aca066e370bf7321 Mon Sep 17 00:00:00 2001 From: Andrey Date: Wed, 26 Jun 2024 22:49:07 +0300 Subject: [PATCH] Add fix of customer_id filter. --- crawlers/mooncrawl/mooncrawl/moonworm_crawler/cli.py | 9 +++++++++ crawlers/mooncrawl/mooncrawl/moonworm_crawler/crawler.py | 2 +- .../mooncrawl/moonworm_crawler/event_crawler.py | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/crawlers/mooncrawl/mooncrawl/moonworm_crawler/cli.py b/crawlers/mooncrawl/mooncrawl/moonworm_crawler/cli.py index 8bab81db..ca4e583f 100644 --- a/crawlers/mooncrawl/mooncrawl/moonworm_crawler/cli.py +++ b/crawlers/mooncrawl/mooncrawl/moonworm_crawler/cli.py @@ -211,6 +211,7 @@ def handle_crawl_v3(args: argparse.Namespace) -> None: blockchain_type, [], {}, + args.customer_uuid, ) logger.info(f"Initial event crawl jobs count: {len(initial_event_jobs)}") @@ -220,6 +221,7 @@ def handle_crawl_v3(args: argparse.Namespace) -> None: blockchain_type, [], {}, + args.customer_uuid, ) logger.info( @@ -878,6 +880,13 @@ def main() -> None: help="Force start from the start block", ) + crawl_parser_v3.add_argument( + "--customer-uuid", + type=UUID, + required=True, + help="Customer UUID", + ) + crawl_parser_v3.set_defaults(func=handle_crawl_v3) historical_crawl_parser = subparsers.add_parser( diff --git a/crawlers/mooncrawl/mooncrawl/moonworm_crawler/crawler.py b/crawlers/mooncrawl/mooncrawl/moonworm_crawler/crawler.py index 807e2ef3..6c266843 100644 --- a/crawlers/mooncrawl/mooncrawl/moonworm_crawler/crawler.py +++ b/crawlers/mooncrawl/mooncrawl/moonworm_crawler/crawler.py @@ -713,7 +713,7 @@ def get_event_crawl_job_records( query = ( db_session.query(AbiJobs) .filter(AbiJobs.chain == blockchain_type.value) - .filter(func.cast(AbiJobs.abi_selector, JSON).op("->>")("type") == "event") + .filter(func.cast(AbiJobs.abi, JSON).op("->>")("type") == "event") ) if customer_id is not None: diff --git a/crawlers/mooncrawl/mooncrawl/moonworm_crawler/event_crawler.py b/crawlers/mooncrawl/mooncrawl/moonworm_crawler/event_crawler.py index af5bcd1f..f20e66ba 100644 --- a/crawlers/mooncrawl/mooncrawl/moonworm_crawler/event_crawler.py +++ b/crawlers/mooncrawl/mooncrawl/moonworm_crawler/event_crawler.py @@ -129,6 +129,7 @@ def _crawl_events( ) -> List[Event]: all_events = [] for job in jobs: + raw_events = _fetch_events_chunk( web3, job.event_abi,