archive-cache: make it more resilient to errors and not break if single metadata is broken

This commit is contained in:
RhodeCode Admin 2025-02-26 04:55:00 +01:00
parent 9dcd00979d
commit 581cfb6cf7
2 changed files with 7 additions and 2 deletions

View file

@ -11,12 +11,13 @@ New Features
- Added automatic PR merging on approved code.
General
^^^^^^^
- Added check to avoid deleting(closing) landing branches during PR merge
- Several Library fixes and updates.
- Archive cache cleanup is more resilient to errors
Security
^^^^^^^^

View file

@ -308,7 +308,11 @@ class BaseCache:
for shard, key_file in self.iter_keys():
with shard.fs.open(os.path.join(shard.storage_medium, key_file), "rb") as f:
metadata = json.loads(f.read())
try:
metadata = json.loads(f.read())
except Exception as e:
log.exception("Failed to decode metadata from %s", key_file)
continue
key_file_path = os.path.join(shard.storage_medium, key_file)