Skip to content

Commit

Permalink
Merge pull request #169 from tskit-dev/fix-race-condition-cache
Browse files Browse the repository at this point in the history
fix race condition, again
  • Loading branch information
awohns authored Feb 16, 2021
2 parents 3d189a4 + c7dc9cf commit 31b6f79
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tsdate/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ def get_cache_dir():
precalculated data.
"""
cache_dir = pathlib.Path(appdirs.user_cache_dir("tsdate", "tsdate"))
if not os.path.exists(cache_dir):
logger.info(f"Set cache_dir to {cache_dir}")
try:
os.makedirs(cache_dir)
logger.info(f"Set cache_dir to {cache_dir}")
except OSError:
logger.info(f"{cache_dir} already exists")
return cache_dir

0 comments on commit 31b6f79

Please sign in to comment.