Skip to content

Commit

Permalink
fix race condition, again
Browse files Browse the repository at this point in the history
  • Loading branch information
awohns committed Feb 16, 2021
1 parent 3d189a4 commit c7dc9cf
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 c7dc9cf

Please sign in to comment.