mirror of
https://github.com/jamiepine/voicebox.git
synced 2026-10-04 01:25:18 -07:00
fix(versions): don't let a locked version file abort the delete cascade
This commit is contained in:
committed by
capy-ai-staging[bot]
parent
4750b47b04
commit
64b4b976d6
@@ -4,6 +4,7 @@ Generation history management module.
|
||||
|
||||
from typing import List, Optional, Tuple
|
||||
from datetime import UTC, datetime
|
||||
import logging
|
||||
import uuid
|
||||
import shutil
|
||||
from pathlib import Path
|
||||
@@ -14,6 +15,8 @@ from ..models import GenerationRequest, GenerationResponse, HistoryQuery, Histor
|
||||
from ..database import Generation as DBGeneration, GenerationVersion as DBGenerationVersion, StoryItem as DBStoryItem, VoiceProfile as DBVoiceProfile
|
||||
from .. import config
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def _delete_generation_children(generation_id: str, db: Session) -> None:
|
||||
"""Remove the rows that reference a generation, plus any version audio files.
|
||||
@@ -334,7 +337,7 @@ async def delete_failed_generations(db: Session) -> int:
|
||||
except OSError:
|
||||
# Best-effort cleanup — don't abort the whole sweep
|
||||
# if a single file can't be removed.
|
||||
pass
|
||||
logger.warning("Could not delete generation audio %s", audio_path)
|
||||
|
||||
db.delete(generation)
|
||||
count += 1
|
||||
@@ -372,7 +375,7 @@ async def delete_generations_by_profile(
|
||||
except OSError:
|
||||
# A file locked by playback shouldn't abort the whole sweep
|
||||
# and leave the profile half-deleted.
|
||||
pass
|
||||
logger.warning("Could not delete generation audio %s", audio_path)
|
||||
|
||||
# Delete from database
|
||||
db.delete(generation)
|
||||
|
||||
Reference in New Issue
Block a user