Skip to content

Commit

Permalink
fix(HACK): bypass BlockAPI.transactions requests until #994
Browse files Browse the repository at this point in the history
  • Loading branch information
fubuloubu committed Aug 18, 2022
1 parent f00c44c commit 44aac00
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/ape_cache/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,11 @@ def _compute_estimate_block_transaction_query(
query: BlockTransactionQuery,
result: CursorResult,
) -> Optional[int]:
if result.scalar() > 0: # type: ignore
# NOTE: Assume 200 msec to get data from database
return 200
# TODO: Update `transactions` table schema so this query functions properly
# Uncomment below after https://github.com/ApeWorX/ape/issues/994
# if result.scalar() > 0: # type: ignore
# # NOTE: Assume 200 msec to get data from database
# return 200

# Can't handle this query
return None
Expand Down Expand Up @@ -377,9 +379,11 @@ def _cache_update_clause(self, query: QueryType) -> Insert:
def _cache_update_block_clause(self, query: BlockQuery) -> Insert:
return insert(Blocks) # type: ignore

@_cache_update_clause.register
def _cache_update_block_txns_clause(self, query: BlockTransactionQuery) -> Insert:
return insert(Transactions) # type: ignore
# TODO: Update `transactions` table schema so we can use `EcosystemAPI.decode_receipt`
# Uncomment below after https://github.com/ApeWorX/ape/issues/994
# @_cache_update_clause.register
# def _cache_update_block_txns_clause(self, query: BlockTransactionQuery) -> Insert:
# return insert(Transactions) # type: ignore

@_cache_update_clause.register
def _cache_update_events_clause(self, query: ContractEventQuery) -> Insert:
Expand Down

0 comments on commit 44aac00

Please sign in to comment.