Update prune.py

This commit is contained in:
Classic298 2025-08-22 16:43:06 +02:00 committed by GitHub
parent 262848d647
commit 4c7e6bd752
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -742,17 +742,15 @@ def cleanup_audio_cache(max_age_days: Optional[int] = 30) -> None:
@router.post("/", response_model=Union[bool, PrunePreviewResult]) @router.post("/", response_model=Union[bool, PrunePreviewResult])
async def prune_data(form_data: PruneDataForm, dry_run: bool = True, user=Depends(get_admin_user)): async def prune_data(form_data: PruneDataForm, user=Depends(get_admin_user)):
""" """
Prunes old and orphaned data using a safe, multi-stage process. Prunes old and orphaned data using a safe, multi-stage process.
If dry_run=True (default), returns preview counts without deleting anything. If dry_run=True (default), returns preview counts without deleting anything.
If dry_run=False, performs actual deletion and returns True on success. If dry_run=False, performs actual deletion and returns True on success.
""" """
log.info(f"DEBUG: dry_run parameter = {dry_run}")
log.info(f"DEBUG: form_data.dry_run = {form_data.dry_run}")
try: try:
if dry_run: if form_data.dry_run:
log.info("Starting data pruning preview (dry run)") log.info("Starting data pruning preview (dry run)")
# Get counts for all enabled operations # Get counts for all enabled operations