From 189d31cc29f4d12c2e87797df2f66f57472d246a Mon Sep 17 00:00:00 2001 From: Marc-Andre Ferland Date: Mon, 24 Oct 2022 05:12:08 -0400 Subject: [PATCH] Specify update_ttl on all get_cached_task calls. --- ui/server.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/server.py b/ui/server.py index dc76a3bf..5521600b 100644 --- a/ui/server.py +++ b/ui/server.py @@ -251,7 +251,7 @@ def ping(session_id:str=None): # Alive response = {'status': str(task_manager.current_state)} if session_id: - task = task_manager.get_cached_task(session_id) + task = task_manager.get_cached_task(session_id, update_ttl=True) if task: response['task'] = id(task) if task.lock.locked(): @@ -320,7 +320,7 @@ def stop(session_id:str=None): raise HTTPException(status_code=409, detail='Not currently running any tasks.') # HTTP409 Conflict task_manager.current_state_error = StopAsyncIteration('') return {'OK'} - task = task_manager.get_cached_task(session_id) + task = task_manager.get_cached_task(session_id, update_ttl=False) if not task: raise HTTPException(status_code=404, detail=f'Session {session_id} has no active task.') # HTTP404 Not Found if isinstance(task.error, StopAsyncIteration): raise HTTPException(status_code=409, detail=f'Session {session_id} task is already stopped.') # HTTP409 Conflict task.error = StopAsyncIteration('')