repository/compact: use get_cache_dir subdirs arg, pathlib for store cache dir

This commit is contained in:
Mrityunjay Raj 2026-07-03 15:55:27 +05:30
parent db89931645
commit 09a1627860
3 changed files with 3 additions and 3 deletions

View file

@ -78,7 +78,7 @@ class ArchiveGarbageCollector:
"""
logger.info("Cleaning up files cache...")
cache_dir = Path(get_cache_dir()) / self.repository.id_str
cache_dir = Path(get_cache_dir(self.repository.id_str, create=False))
if not cache_dir.exists():
logger.debug("Cache directory does not exist, skipping files cache cleanup")
return

View file

@ -351,7 +351,7 @@ class Repository:
cache_dir = Path(get_cache_dir("storecache"))
else:
cache_dir = Path(store_cache)
os.makedirs(cache_dir, exist_ok=True)
cache_dir.mkdir(parents=True, exist_ok=True)
ns_config["packs/"]["cache"] = "writethrough"
cache_size = os.environ.get("BORG_PACK_CACHE_SIZE")
if cache_size:

View file

@ -223,7 +223,7 @@ def test_compact_files_cache_cleanup(archivers, request):
pytest.fail("Could not find repository ID in info output")
# Check cache directory for files cache files
cache_dir = Path(get_cache_dir()) / repo_id
cache_dir = Path(get_cache_dir(repo_id, create=False))
if not cache_dir.exists():
pytest.skip("Cache directory does not exist, skipping test")