Skip to content

Commit dc86cf8

Browse files
committed
Make Echidna status checking tolerate transient failure
It often happens that checking the Echinda status too quickly after request upload results in failure (to get the validation results), but checking it shortly after that would result in success. So, make the status-check script retry a couple of times on failure.
1 parent 12e754f commit dc86cf8

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

document/util/check-echidna-status.py

+12-5
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,20 @@ def get_echidna_id(directory):
2323
def get_current_response(echidna_id):
2424
url = ECHIDNA_STATUS_URL + echidna_id
2525
print(f'Fetching {url}')
26-
response = requests.get(url, allow_redirects=True)
27-
if response.status_code != 200:
26+
retry = 2
27+
while retry:
28+
response = requests.get(url, allow_redirects=True)
29+
if response.status_code == 200:
30+
return response.json()
31+
2832
print(f'Got status code {response.status_code}, text:')
29-
print(response.text)
30-
raise Exception('Failed to fetch echidna result')
33+
retry -= 1
34+
if retry:
35+
print('Retrying in 5s')
36+
37+
print(response.text)
38+
raise Exception('Failed to fetch echidna result')
3139

32-
return response.json()
3340

3441

3542
def get_echidna_result(echidna_id):

0 commit comments

Comments
 (0)