Merge pull request #2945 from ThomasWaldmann/workaround-files-cache-corruption-1.1

ignore corrupt files cache, fixes #2939
This commit is contained in:
enkore 2017-08-20 21:39:05 +02:00 committed by GitHub
commit 1a05e8f446
1 changed files with 10 additions and 4 deletions

View File

@ -503,10 +503,16 @@ class LocalCache(CacheStatsMixin):
if not data:
break
u.feed(data)
for path_hash, item in u:
entry = FileCacheEntry(*item)
# in the end, this takes about 240 Bytes per file
self.files[path_hash] = msgpack.packb(entry._replace(age=entry.age + 1))
try:
for path_hash, item in u:
entry = FileCacheEntry(*item)
# in the end, this takes about 240 Bytes per file
self.files[path_hash] = msgpack.packb(entry._replace(age=entry.age + 1))
except (TypeError, ValueError) as exc:
logger.warning('The files cache seems corrupt, ignoring it. '
'Expect lower performance. [%s]' % str(exc))
self.files = {}
return
def begin_txn(self):
# Initialize transaction snapshot