forked from extern/easydiffusion
Specify update_ttl on all get_cached_task calls.
This commit is contained in:
parent
fc875651d3
commit
189d31cc29
@ -251,7 +251,7 @@ def ping(session_id:str=None):
|
|||||||
# Alive
|
# Alive
|
||||||
response = {'status': str(task_manager.current_state)}
|
response = {'status': str(task_manager.current_state)}
|
||||||
if session_id:
|
if session_id:
|
||||||
task = task_manager.get_cached_task(session_id)
|
task = task_manager.get_cached_task(session_id, update_ttl=True)
|
||||||
if task:
|
if task:
|
||||||
response['task'] = id(task)
|
response['task'] = id(task)
|
||||||
if task.lock.locked():
|
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
|
raise HTTPException(status_code=409, detail='Not currently running any tasks.') # HTTP409 Conflict
|
||||||
task_manager.current_state_error = StopAsyncIteration('')
|
task_manager.current_state_error = StopAsyncIteration('')
|
||||||
return {'OK'}
|
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 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
|
if isinstance(task.error, StopAsyncIteration): raise HTTPException(status_code=409, detail=f'Session {session_id} task is already stopped.') # HTTP409 Conflict
|
||||||
task.error = StopAsyncIteration('')
|
task.error = StopAsyncIteration('')
|
||||||
|
Loading…
Reference in New Issue
Block a user