Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Juliya Smith <yingthi@live.com>
  • Loading branch information
wakamex and antazoey committed Nov 4, 2022
1 parent 61ab88d commit a952577
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions ape_alchemy/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand All @@ -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)
Expand Down

0 comments on commit a952577

Please sign in to comment.