fix: quarantine failed product cleanups in failed_cleanup state

This commit is contained in:
2026-09-12 15:00:33 +08:00
parent b3ab1bfc52
commit bd78eef161
7 changed files with 149 additions and 19 deletions
+3 -1
View File
@@ -126,7 +126,9 @@ class CleanupService:
if product_dir.exists():
shutil.rmtree(product_dir)
except Exception:
self.product_store.release_product_purge(product.product_id)
# rmtree may have removed only part of the archive. Quarantine
# the record for manual inspection instead of retrying it.
self.product_store.fail_product_purge(product.product_id)
raise
self.product_store.finalize_product_purge(product.product_id, now=now_utc)
report.deleted_product_ids.append(product.product_id)