give up if download fails multiple times

This commit is contained in:
j 2019-01-13 12:30:45 +05:30
parent 554e65cbd3
commit 616a06270d
1 changed files with 3 additions and 1 deletions

View File

@ -333,7 +333,9 @@ class Update(Thread):
def install(self):
while update_available():
self.status('Downloading...')
while not download():
max_retry = 5
while max_retry > 0 and not download():
max_retry -= 1
self.status('Download failed, retrying...')
time.sleep(5)
self.status('Downloading...')