diff --git a/safe_transaction_service/history/indexers/safe_events_indexer.py b/safe_transaction_service/history/indexers/safe_events_indexer.py index 15c3df87e..e0c490e04 100644 --- a/safe_transaction_service/history/indexers/safe_events_indexer.py +++ b/safe_transaction_service/history/indexers/safe_events_indexer.py @@ -511,19 +511,21 @@ def _process_safe_creation_events( Process creation events (ProxyCreation and SafeSetup). :param safe_addresses_with_creation_events: - :return: + :return: Dictionary with a Safe address and a list of creation related events (ProxyCreation and SafeSetup) """ internal_txs = [] internal_decoded_txs = [] - # Check if were indexed + # Check if contracts were already indexed safe_creation_events_addresses = set(safe_addresses_with_creation_events.keys()) - indexed_addresses = InternalTxDecoded.objects.filter( - internal_tx___from__in=safe_creation_events_addresses, - function_name="setup", - internal_tx__contract_address=None, - ).values_list("internal_tx___from", flat=True) - # Ignoring the already indexed contracts - addresses_to_index = safe_creation_events_addresses - set(indexed_addresses) + indexed_addresses = set( + InternalTxDecoded.objects.filter( + internal_tx___from__in=safe_creation_events_addresses, + function_name="setup", + internal_tx__contract_address=None, + ).values_list("internal_tx___from", flat=True) + ) + # Ignoring already indexed contracts + addresses_to_index = safe_creation_events_addresses - indexed_addresses for safe_address in addresses_to_index: events = safe_addresses_with_creation_events[safe_address] diff --git a/safe_transaction_service/history/models.py b/safe_transaction_service/history/models.py index bd60c7f85..3b91f4631 100644 --- a/safe_transaction_service/history/models.py +++ b/safe_transaction_service/history/models.py @@ -269,7 +269,7 @@ def create_from_block( f"Marking block as not confirmed" ) - @lru_cache(maxsize=100_000) + @lru_cache(maxsize=1_000_000) def get_timestamp_by_hash(self, block_hash: HexBytes) -> datetime.datetime: try: return self.values("timestamp").get(block_hash=block_hash)["timestamp"]