diff --git a/backend/__init__.py b/backend/__init__.py index 28a833a3..1d5b4ae2 100644 --- a/backend/__init__.py +++ b/backend/__init__.py @@ -429,7 +429,7 @@ class Worker(threading.Thread): if uuid in list(datastore.data['watching'].keys()): try: - result, contents = update_handler.run(uuid) + changed_detected, result, contents = update_handler.run(uuid) except PermissionError as s: app.logger.error("File permission error updating", uuid, str(s)) @@ -437,8 +437,7 @@ class Worker(threading.Thread): if result: datastore.update_watch(uuid=uuid, update_obj=result) - - if contents: + if changed_detected: # A change was detected datastore.save_history_text(uuid=uuid, contents=contents, result_obj=result) diff --git a/backend/fetch_site_status.py b/backend/fetch_site_status.py index f03cdb00..c3e557e0 100644 --- a/backend/fetch_site_status.py +++ b/backend/fetch_site_status.py @@ -14,6 +14,7 @@ class perform_site_check(): def run(self, uuid): timestamp = int(time.time()) # used for storage etc too stripped_text_from_html = False + changed_detected = False update_obj = {'previous_md5': self.datastore.data['watching'][uuid]['previous_md5'], 'history': {}, @@ -79,6 +80,7 @@ class perform_site_check(): # could be None or False depending on JSON type if self.datastore.data['watching'][uuid]['previous_md5'] != fetched_md5: + changed_detected = True # Don't confuse people by updating as last-changed, when it actually just changed from None.. if self.datastore.get_val(uuid, 'previous_md5'): @@ -86,4 +88,4 @@ class perform_site_check(): update_obj["previous_md5"] = fetched_md5 - return update_obj, stripped_text_from_html + return changed_detected, update_obj, stripped_text_from_html