File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66# Licensed under the MIT license:
77# http://www.opensource.org/licenses/MIT-license
88# Copyright (c) 2016, Shay Palachy <shaypal5@gmail.com>
9+ import hashlib
910import logging
1011import os
1112import pickle # for local caching
@@ -106,7 +107,10 @@ def cache_fpath(self) -> str:
106107
107108 @property
108109 def _shared_lock_fpath (self ) -> str :
109- return f"{ self .cache_fpath } { self ._SHARED_LOCK_SUFFIX } "
110+ lock_dir = os .path .join (tempfile .gettempdir (), "cachier-locks" )
111+ os .makedirs (lock_dir , exist_ok = True )
112+ cache_hash = hashlib .sha256 (self .cache_fpath .encode ("utf-8" )).hexdigest ()
113+ return os .path .join (lock_dir , f"{ cache_hash } { self ._SHARED_LOCK_SUFFIX } " )
110114
111115 @staticmethod
112116 def _convert_legacy_cache_entry (
@@ -285,6 +289,7 @@ async def amark_entry_being_calculated(self, key: str) -> None:
285289 def mark_entry_not_calculated (self , key : str ) -> None :
286290 if self .separate_files :
287291 self ._mark_entry_not_calculated_separate_files (key )
292+ return # pragma: no cover
288293 with self .lock :
289294 cache = self .get_cache_dict ()
290295 # that's ok, we don't need an entry in that case
You can’t perform that action at this time.
0 commit comments