Skip to contentSkip to conversation

scripts/clean_functional_cache: Remove also .stamp files

PATCH In review Thomas Huth 2 participants 2 messages Aug 14

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scripts/clean_functional_cache: Remove also .stamp files

The cache cleanup script already successfully removes the assets that are unused since more than 6 months, but it forgot to delete the corresponding timestamp files, too.

---
 scripts/clean_functional_cache.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
scripts/clean_functional_cache.py +3 -1
index c3370ffbb87..1ff98c7606d 100755
@@ -28,8 +28,9 @@
     if len(file.name) != 64:
         continue
 
+    stampfile = file.with_suffix(".stamp")
     try:
-        timestamp = int(file.with_suffix(".stamp").read_text())
+        timestamp = int(stampfile.read_text())
     except FileNotFoundError:
         # Assume it's an old file that was already in the cache before we
         # added the code for evicting stale assets. Use the release date
@@ -43,3 +44,4 @@
         print(f"Removing {cache_dir}/{file.name}.")
         file.chmod(stat.S_IWRITE)
         file.unlink()
+        stampfile.unlink()
Signature · 1 line
2.55.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Thomas Huth

The cache cleanup script already successfully removes the assets that are unused since more than 6 months, but it forgot to delete the corresponding timestamp files, too.

---
 scripts/clean_functional_cache.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|