Commit 6af932af authored by Tiago Peixoto's avatar Tiago Peixoto

analyze.py: avoid re-writing of global cache

parent bab717e0
......@@ -284,12 +284,13 @@ def analyze_entries(entries, names=[], skip=[], force=[], cache_only=True,
global analyses
analyze_cache = {}
updated_global_cache = False
if global_cache:
with acquire_lock_file("./cache/analyze_cache.lock", block=True) as lock:
try:
with open("./cache/analyze_cache.pickle", "rb") as f:
analyze_cache = pickle.load(f)
except FileNotFoundError:
except (FileNotFoundError, EOFError, IOError):
pass
for entry in entries:
......@@ -333,8 +334,9 @@ def analyze_entries(entries, names=[], skip=[], force=[], cache_only=True,
if global_cache:
analyze_cache[entry.name] = (entry.analyses, entry._analyses)
updated_global_cache = True
if global_cache:
if global_cache and updated_global_cache:
with acquire_lock_file("./cache/analyze_cache.lock", block=True) as lock:
with open("./cache/analyze_cache.pickle", "wb") as f:
pickle.dump(analyze_cache, f)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment