mirror of
https://github.com/jamiepine/voicebox.git
synced 2026-10-03 09:05:17 -07:00
isolate shutdown unload calls so one failure doesn't block the other
This commit is contained in:
@@ -202,8 +202,14 @@ def _register_lifecycle(application: FastAPI) -> None:
|
|||||||
@application.on_event("shutdown")
|
@application.on_event("shutdown")
|
||||||
async def shutdown_event():
|
async def shutdown_event():
|
||||||
logger.info("Voicebox server shutting down...")
|
logger.info("Voicebox server shutting down...")
|
||||||
|
try:
|
||||||
tts.unload_tts_model()
|
tts.unload_tts_model()
|
||||||
|
except Exception:
|
||||||
|
logger.exception("Failed to unload TTS model")
|
||||||
|
try:
|
||||||
transcribe.unload_whisper_model()
|
transcribe.unload_whisper_model()
|
||||||
|
except Exception:
|
||||||
|
logger.exception("Failed to unload Whisper model")
|
||||||
|
|
||||||
|
|
||||||
app = create_app()
|
app = create_app()
|
||||||
|
|||||||
Reference in New Issue
Block a user