Retry more on CI when vendor download fails

This commit is contained in:
Kovid Goyal 2021-01-12 07:36:31 +05:30
parent 1d89aa737a
commit 9b5605c9b9
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -28,14 +28,15 @@ class ReVendor(Command):
def download_vendor_release(self, tdir, url):
self.info('Downloading %s:' % self.TAR_NAME, url)
try:
raw = download_securely(url)
except Exception:
if not is_ci:
raise
num = 5 if is_ci else 1
for i in range(num):
try:
raw = download_securely(url)
except Exception:
if i == num - 1:
raise
self.info('Download failed, sleeping and retrying...')
time.sleep(2)
raw = download_securely(url)
with tarfile.open(fileobj=BytesIO(raw)) as tf:
tf.extractall(tdir)
if len(os.listdir(tdir)) == 1: