Merge pull request #7678 from ThomasWaldmann/fix-crash-files-cache-size-1.2

--files-cache=size: fix crash, fixes #7658
This commit is contained in:
TW 2023-06-27 21:36:49 +02:00 committed by GitHub
commit 1da5beacb3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1046,6 +1046,9 @@ class LocalCache(CacheStatsMixin):
elif 'm' in cache_mode:
cmtime_type = 'mtime'
cmtime_ns = safe_ns(st.st_mtime_ns)
else: # neither 'c' nor 'm' in cache_mode, avoid UnboundLocalError
cmtime_type = 'ctime'
cmtime_ns = safe_ns(st.st_ctime_ns)
entry = FileCacheEntry(age=0, inode=st.st_ino, size=st.st_size, cmtime=int_to_bigint(cmtime_ns), chunk_ids=ids)
self.files[path_hash] = msgpack.packb(entry)
self._newest_cmtime = max(self._newest_cmtime or 0, cmtime_ns)