Skip to content

Commit

Permalink
ensure directory exists
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanpulver committed Jul 3, 2024
1 parent 4b6f8c2 commit 54acd42
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions safety/safety.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@

def get_from_cache(db_name: str, cache_valid_seconds: int = 0, skip_time_verification: bool = False) -> Optional[Dict[str, Any]]:
cache_file_lock = f"{DB_CACHE_FILE}.lock"
os.makedirs(os.path.dirname(cache_file_lock), exist_ok=True)
lock = FileLock(cache_file_lock, timeout=10)
with lock:
if os.path.exists(DB_CACHE_FILE):
Expand Down

0 comments on commit 54acd42

Please sign in to comment.