From 7b4ed2429dd8a88e19b36091e9534f9c3b6ab64b Mon Sep 17 00:00:00 2001 From: Leigh Morresi <275001+dgtlmoon@users.noreply.github.com> Date: Mon, 1 Feb 2021 16:56:26 +0100 Subject: [PATCH] Include a selfcheck/diagnosis routine --- backend/backend.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/backend/backend.py b/backend/backend.py index aba9c08e..be9c29c6 100644 --- a/backend/backend.py +++ b/backend/backend.py @@ -216,6 +216,20 @@ def favicon(): return send_from_directory("/app/static/images", filename="favicon.ico") +# A few self sanity checks, mostly for developer/bug check +@app.route("/self-check", methods=['GET']) +def selfcheck(): + output = "All fine" + # In earlier versions before a single threaded write of the JSON store, sometimes histories could get mixed. + # Could also maybe affect people who manually fiddle with their JSON store? + for uuid, watch in datastore.data['watching'].items(): + for timestamp, path in watch['history'].items(): + # Each history snapshot should include a full path, which contains the {uuid} + if not uuid in path: + output = "Something weird in {}, suspected incorrect snapshot path.".format(uuid) + + + return output @app.route("/static//", methods=['GET']) def static_content(group, filename): try: