From f454e7ced98ba81e2651fe0d8c2048210e5a5fd0 Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Mon, 6 Jan 2025 16:10:02 +0100 Subject: [PATCH] Only call send_content_changed_notification on change --- changedetectionio/update_worker.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/changedetectionio/update_worker.py b/changedetectionio/update_worker.py index 7e49645ce..6c653bd62 100644 --- a/changedetectionio/update_worker.py +++ b/changedetectionio/update_worker.py @@ -554,12 +554,11 @@ class update_worker(threading.Thread): # attribute .last_changed is then based on this data watch.save_last_fetched_html(contents=update_handler.fetcher.content, timestamp=fetch_start_time) - # Notifications should only trigger on the second time (first time, we gather the initial snapshot) - if watch.history_n >= 2: - logger.info(f"Change detected in UUID {uuid} - {watch['url']}") - if not watch.get('notification_muted'): - # @todo only run this if notifications exist - self.send_content_changed_notification(watch_uuid=uuid) + # Notifications should only trigger on the second time (first time, we gather the initial snapshot) + if watch.history_n >= 2: + logger.info(f"Change detected in UUID {uuid} - {watch['url']}") + if not watch.get('notification_muted'): + self.send_content_changed_notification(watch_uuid=uuid) except Exception as e: # Catch everything possible here, so that if a worker crashes, we don't lose it until restart!