Increase number of retries when uploading to github as it is getting flakier than ever

This commit is contained in:
Kovid Goyal 2023-01-20 07:11:52 +05:30
parent e5bc7255b2
commit 81cc09aa61
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -294,7 +294,7 @@ class GitHub(Base): # {{{
time.sleep(1) time.sleep(1)
self.fail(r, f'Failed to delete {fname} from GitHub') self.fail(r, f'Failed to delete {fname} from GitHub')
def upload_with_retries(path: str, desc: str, num_tries: int = 4, sleep_time: float = 10.0) -> None: def upload_with_retries(path: str, desc: str, num_tries: int = 8, sleep_time: float = 60.0) -> None:
fname = os.path.basename(path) fname = os.path.basename(path)
if self.is_nightly: if self.is_nightly:
fname = fname.replace(version, 'nightly') fname = fname.replace(version, 'nightly')
@ -305,12 +305,10 @@ class GitHub(Base): # {{{
for i in range(1, num_tries+1): for i in range(1, num_tries+1):
try: try:
r = self.do_upload(upload_url, path, desc, fname) r = self.do_upload(upload_url, path, desc, fname)
except Exception: except Exception as e:
if i >= num_tries: if i >= num_tries:
raise raise
import traceback print('Failed to upload with error:', e, 'retrying in a short while...', file=sys.stderr)
traceback.print_exc()
print('Failed to upload retrying in a short while...', file=sys.stderr)
else: else:
if r.status_code == 201: if r.status_code == 201:
break break