From 7df78defb1b4fdcf6c8ea65f44e481778dd7b466 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 17 Oct 2017 11:05:32 +0200 Subject: [PATCH] Make data version part of etag We might add fields to things like file entries (e.g. "display") and in such cases want to refetch the list even if the files itself didn't change, to make sure those new fields are available to the clients. See https://github.com/foosel/OctoPrint/issues/2111#issuecomment-337164940 --- src/octoprint/server/api/files.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/octoprint/server/api/files.py b/src/octoprint/server/api/files.py index 214735af..d7f8f25f 100644 --- a/src/octoprint/server/api/files.py +++ b/src/octoprint/server/api/files.py @@ -29,6 +29,8 @@ import threading _file_cache = dict() _file_cache_mutex = threading.RLock() +_FILES_DATA_VERSION = 1 + def _clear_file_cache(): with _file_cache_mutex: _file_cache.clear() @@ -71,6 +73,7 @@ def _create_etag(path, filter, recursive, lm=None): return None hash = hashlib.sha1() + hash.update(str(_FILES_DATA_VERSION)) hash.update(str(lm)) hash.update(str(filter)) hash.update(str(recursive))