Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/fcache/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,13 @@ def delete(self):
"""Delete the write buffer and cache directory."""
if not self._sync:
del self._buffer
shutil.rmtree(self.cache_dir)

# Allow multiple processes to delete() at the same time, meaning some or all of cache_dir may already be deleted
def _on_error(function, path, excinfo):
if excinfo[0] != FileNotFoundError:
raise

shutil.rmtree(self.cache_dir, onerror=_on_error)

def close(self):
"""Sync the write buffer, then close the cache.
Expand Down
Loading