mirror of
https://github.com/dgtlmoon/changedetection.io.git
synced 2025-12-12 11:05:42 +00:00
Tidy up return logic
This commit is contained in:
@@ -429,7 +429,7 @@ class Worker(threading.Thread):
|
|||||||
if uuid in list(datastore.data['watching'].keys()):
|
if uuid in list(datastore.data['watching'].keys()):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
result, contents = update_handler.run(uuid)
|
changed_detected, result, contents = update_handler.run(uuid)
|
||||||
|
|
||||||
except PermissionError as s:
|
except PermissionError as s:
|
||||||
app.logger.error("File permission error updating", uuid, str(s))
|
app.logger.error("File permission error updating", uuid, str(s))
|
||||||
@@ -437,8 +437,7 @@ class Worker(threading.Thread):
|
|||||||
if result:
|
if result:
|
||||||
|
|
||||||
datastore.update_watch(uuid=uuid, update_obj=result)
|
datastore.update_watch(uuid=uuid, update_obj=result)
|
||||||
|
if changed_detected:
|
||||||
if contents:
|
|
||||||
# A change was detected
|
# A change was detected
|
||||||
datastore.save_history_text(uuid=uuid, contents=contents, result_obj=result)
|
datastore.save_history_text(uuid=uuid, contents=contents, result_obj=result)
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ class perform_site_check():
|
|||||||
def run(self, uuid):
|
def run(self, uuid):
|
||||||
timestamp = int(time.time()) # used for storage etc too
|
timestamp = int(time.time()) # used for storage etc too
|
||||||
stripped_text_from_html = False
|
stripped_text_from_html = False
|
||||||
|
changed_detected = False
|
||||||
|
|
||||||
update_obj = {'previous_md5': self.datastore.data['watching'][uuid]['previous_md5'],
|
update_obj = {'previous_md5': self.datastore.data['watching'][uuid]['previous_md5'],
|
||||||
'history': {},
|
'history': {},
|
||||||
@@ -79,6 +80,7 @@ class perform_site_check():
|
|||||||
|
|
||||||
# could be None or False depending on JSON type
|
# could be None or False depending on JSON type
|
||||||
if self.datastore.data['watching'][uuid]['previous_md5'] != fetched_md5:
|
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..
|
# Don't confuse people by updating as last-changed, when it actually just changed from None..
|
||||||
if self.datastore.get_val(uuid, 'previous_md5'):
|
if self.datastore.get_val(uuid, 'previous_md5'):
|
||||||
@@ -86,4 +88,4 @@ class perform_site_check():
|
|||||||
|
|
||||||
update_obj["previous_md5"] = fetched_md5
|
update_obj["previous_md5"] = fetched_md5
|
||||||
|
|
||||||
return update_obj, stripped_text_from_html
|
return changed_detected, update_obj, stripped_text_from_html
|
||||||
|
|||||||
Reference in New Issue
Block a user