Skip to content

The open-source AI voice studio. Clone, dictate, create.

isolate shutdown unload calls so one failure doesn't block the other

James Pine60c0fe3b928d
diff --git a/backend/app.py b/backend/app.py
index dfe1e1a0..fb6dc89c 100644
--- a/backend/app.py
+++ b/backend/app.py
@@ -202,8 +202,14 @@ def _register_lifecycle(application: FastAPI) -> None:
@application.on_event("shutdown")
async def shutdown_event():
logger.info("Voicebox server shutting down...")
- tts.unload_tts_model()
- transcribe.unload_whisper_model()
+ try:
+ tts.unload_tts_model()
+ except Exception:
+ logger.exception("Failed to unload TTS model")
+ try:
+ transcribe.unload_whisper_model()
+ except Exception:
+ logger.exception("Failed to unload Whisper model")
app = create_app()