From 616a06270da2121c4231e647f2572c58d8bd52f5 Mon Sep 17 00:00:00 2001 From: j Date: Sun, 13 Jan 2019 12:30:45 +0530 Subject: [PATCH] give up if download fails multiple times --- oml/update.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/oml/update.py b/oml/update.py index c265f63..566d66b 100644 --- a/oml/update.py +++ b/oml/update.py @@ -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...')