fix: quarantine failed product cleanups in failed_cleanup state
This commit is contained in:
@@ -21,7 +21,7 @@ from .schemas import ProductVersionRecord
|
||||
|
||||
|
||||
class ProductPendingCleanupError(ValueError):
|
||||
"""Raised when a soft-deleted product is changed before restoration."""
|
||||
"""Raised when a pending or failed-cleanup product is changed before recovery."""
|
||||
|
||||
|
||||
class ProductArchiveService:
|
||||
@@ -83,7 +83,7 @@ class ProductArchiveService:
|
||||
if not isinstance(document, dict):
|
||||
raise ValueError("document must be a JSON object")
|
||||
product = self.store.get_product(product_id)
|
||||
if product.status == "pending_cleanup":
|
||||
if product.status in ("pending_cleanup", "failed_cleanup"):
|
||||
raise ProductPendingCleanupError("product is pending cleanup")
|
||||
if product.status != "active":
|
||||
raise ValueError("product is not active")
|
||||
|
||||
Reference in New Issue
Block a user