diff --git a/ape_alchemy/provider.py b/ape_alchemy/provider.py index a856d39..1c79379 100644 --- a/ape_alchemy/provider.py +++ b/ape_alchemy/provider.py @@ -140,7 +140,6 @@ def _make_request(self, endpoint: str, parameters: list) -> Any: RETRY_BACKOFF_FACTOR = 2 MAX_RETRY_DELAY = 30000 MAX_RETRIES = 3 - # RETRY_INTERVAL = 1000 RETRY_JITTER = 250 for i in range(0,MAX_RETRIES): print(f"_make_request attempt {i}") @@ -157,7 +156,7 @@ def _make_request(self, endpoint: str, parameters: list) -> Any: if isinstance(error_data, dict) else error_data ) - if message.__contains__("exceeded its compute units"): + if "exceeded its compute units" in message: RETRY_INTERVAL = min(MAX_RETRY_DELAY, MIN_RETRY_DELAY * RETRY_BACKOFF_FACTOR ** i) print(f"Alchemy compute units exceeded, retrying #{i} in {RETRY_INTERVAL} ms") delay = RETRY_INTERVAL + random.randint(0, RETRY_JITTER)