From 843a93fe28d26591f25afc74798ffdf13e8728eb Mon Sep 17 00:00:00 2001 From: Ozzieisaacs Date: Sun, 24 Mar 2019 15:15:36 +0100 Subject: [PATCH] Updater fix for slow servers --- cps/updater.py | 2 +- cps/web.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cps/updater.py b/cps/updater.py index 1e0b8115..f1c0b95f 100644 --- a/cps/updater.py +++ b/cps/updater.py @@ -51,7 +51,7 @@ class Updater(threading.Thread): def __init__(self): threading.Thread.__init__(self) - self.status = 0 + self.status = -1 self.updateIndex = None def get_current_version_info(self): diff --git a/cps/web.py b/cps/web.py index cd8abf1e..b9cd867c 100644 --- a/cps/web.py +++ b/cps/web.py @@ -1192,16 +1192,20 @@ def get_updater_status(): } status['text'] = text # helper.updater_thread = helper.Updater() + updater_thread.status = 0 updater_thread.start() status['status'] = updater_thread.get_update_status() elif request.method == "GET": try: status['status'] = updater_thread.get_update_status() + if status['status'] == -1: + status['status'] = 7 except AttributeError: # thread is not active, occours after restart on update status['status'] = 7 except Exception: status['status'] = 11 + app.logger.error(status['status']) return json.dumps(status)