Selaa lähdekoodia

ChunksMixin: don't use self._chunks until it is demand-built

Thomas Waldmann 1 kuukausi sitten
vanhempi
sitoutus
7dfc88a493
1 muutettua tiedostoa jossa 2 lisäystä ja 1 poistoa
  1. 2 1
      src/borg/cache.py

+ 2 - 1
src/borg/cache.py

@@ -899,7 +899,8 @@ class ChunksMixin:
 
     def _maybe_write_chunks_cache(self, now, force=False, clear=False):
         if force or now > self.chunks_cache_last_write + self.chunks_cache_write_td:
-            write_chunkindex_to_repo_cache(self.repository, self._chunks, clear=clear)
+            if self._chunks is not None:
+                write_chunkindex_to_repo_cache(self.repository, self._chunks, clear=clear)
             self.chunks_cache_last_write = now
 
     def refresh_lock(self, now):