From 5bbd82be793db39dbdcf2c10d583e2025c2ee9fc Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Thu, 9 Dec 2021 23:28:17 +0100 Subject: [PATCH] Wait 60 seconds or until stop_thread is set --- changedetectionio/store.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/changedetectionio/store.py b/changedetectionio/store.py index b2832400..b4ebbc2e 100644 --- a/changedetectionio/store.py +++ b/changedetectionio/store.py @@ -392,7 +392,11 @@ class ChangeDetectionStore: self.sync_to_json() # Once per minute is enough, more and it can cause high CPU usage - time.sleep(60) + # better here is to use something like self.app.config.exit.wait(1), but we cant get to 'app' from here + for i in range(30): + time.sleep(2) + if self.stop_thread: + break # Go through the datastore path and remove any snapshots that are not mentioned in the index # This usually is not used, but can be handy.