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
This commit is contained in:
parent
d0aa81c977
commit
7df78defb1
1 changed files with 3 additions and 0 deletions
|
|
@ -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))
|
||||
|
|
|
|||
Loading…
Reference in a new issue