From 4a7260b1be1c3b383f2df7914d6709d1baade799 Mon Sep 17 00:00:00 2001 From: Marc-Andre Ferland Date: Fri, 14 Oct 2022 05:20:44 -0400 Subject: [PATCH] StopAsyncIteration should not trigger HTTP500. Now returns faster into the ready state. --- ui/server.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ui/server.py b/ui/server.py index 3414cf66..18d5214e 100644 --- a/ui/server.py +++ b/ui/server.py @@ -279,8 +279,10 @@ def save_model_to_config(model_name): @app.get('/ping') # Get server and optionally session status. def ping(session_id:str=None): - if current_state_error or not render_thread.is_alive(): # Render thread is dead. - return HTTPException(status_code=500, detail=str(current_state_error)) + if not render_thread.is_alive(): # Render thread is dead. + if current_state_error: return HTTPException(status_code=500, detail=str(current_state_error)) + return HTTPException(status_code=500, detail='Render thread is dead.') + if current_state_error and not isinstance(current_state_error, StopAsyncIteration): return HTTPException(status_code=500, detail=str(current_state_error)) # Alive response = {'status': str(current_state)} if session_id: