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

View file

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