From b0c5dbd88eea2bccfc6ba826865b957bcf300513 Mon Sep 17 00:00:00 2001 From: Leigh Morresi <275001+dgtlmoon@users.noreply.github.com> Date: Sun, 21 Feb 2021 13:46:16 +0100 Subject: [PATCH] Just use the current/previous md5 --- backend/__init__.py | 3 +-- backend/fetch_site_status.py | 2 +- backend/store.py | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/backend/__init__.py b/backend/__init__.py index e597c766..cf090abb 100644 --- a/backend/__init__.py +++ b/backend/__init__.py @@ -450,8 +450,7 @@ class Worker(threading.Thread): app.logger.error("File permission error updating", uuid, str(s)) else: if result: - - result["previous_md5"] = result["current_md5"] + datastore.update_watch(uuid=uuid, update_obj=result) if contents: diff --git a/backend/fetch_site_status.py b/backend/fetch_site_status.py index 225ed812..dad9c2de 100644 --- a/backend/fetch_site_status.py +++ b/backend/fetch_site_status.py @@ -89,6 +89,6 @@ class perform_site_check(): update_obj["last_changed"] = timestamp - update_obj["current_md5"] = fetched_md5 + update_obj["previous_md5"] = fetched_md5 return update_obj, stripped_text_from_html diff --git a/backend/store.py b/backend/store.py index ca0f95f4..49f76681 100644 --- a/backend/store.py +++ b/backend/store.py @@ -198,7 +198,7 @@ class ChangeDetectionStore: def save_history_text(self, uuid, result_obj, contents): output_path = "{}/{}".format(self.datastore_path, uuid) - fname = "{}/{}-{}.stripped.txt".format(output_path, result_obj['current_md5'], str(time.time())) + fname = "{}/{}-{}.stripped.txt".format(output_path, result_obj['previous_md5'], str(time.time())) with open(fname, 'w') as f: f.write(contents) f.close()