Skip to content

Commit

Permalink
print a message before delay and retry
Browse files Browse the repository at this point in the history
  • Loading branch information
mubarak23 committed Oct 4, 2024
1 parent b83b2a8 commit abb2a97
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions scripts/data/generate_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
FAST = False

RETRIES = 3
DEPLAY = 2
DELAY = 2


def request_rpc(method: str, params: list):
Expand All @@ -46,7 +46,8 @@ def request_rpc(method: str, params: list):
return res.json()["result"]
except Exception:
if attempt < RETRIES - 1:
time.sleep(DEPLAY) # Wait before retrying
f"Connection error: {res.text}, will retry in {DELAY}s"
time.sleep(DELAY) # Wait before retrying
else:
raise ConnectionError(
f"Unexpected RPC response after {RETRIES} attempts:\n{res.text}"
Expand Down

0 comments on commit abb2a97

Please sign in to comment.