Skip to content

Commit

Permalink
fix: update queries estimation
Browse files Browse the repository at this point in the history
  • Loading branch information
tmcgroul committed Dec 29, 2023
1 parent b32eb5e commit 3f5b9cf
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions ape_subsquid/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,21 @@ def estimate_query(self, query: QueryType) -> Optional[int]: # type: ignore[ove

@estimate_query.register
def estimate_block_query(self, query: BlockQuery) -> int:
return 0
return 100 + (query.stop_block - query.start_block) * 4

@estimate_query.register
def estimate_account_transaction_query(self, query: AccountTransactionQuery) -> int:
return 0
# the entire network can be scanned in a worst-case scenario
# so just high value is used (10 min)
return 1000 * 60 * 10

@estimate_query.register
def estimate_contract_creation_query(self, query: ContractCreationQuery) -> int:
return 0
return 100 + (query.stop_block - query.start_block) * 5

@estimate_query.register
def estimate_contract_event_query(self, query: ContractEventQuery) -> int:
return 0
return 400 + (query.stop_block - query.start_block) * 4

@singledispatchmethod
def perform_query(self, query: QueryType) -> Iterator: # type: ignore[override]
Expand Down

0 comments on commit 3f5b9cf

Please sign in to comment.