mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-12 04:15:25 +00:00
Merge pull request #17195 from ShirasawaSama/patch-14
fix: fix error when stopping non-existent task
This commit is contained in:
commit
93132abb40
1 changed files with 2 additions and 2 deletions
|
|
@ -153,9 +153,9 @@ async def stop_task(redis, task_id: str):
|
||||||
# Optionally check if task_id still in Redis a few moments later for feedback?
|
# Optionally check if task_id still in Redis a few moments later for feedback?
|
||||||
return {"status": True, "message": f"Stop signal sent for {task_id}"}
|
return {"status": True, "message": f"Stop signal sent for {task_id}"}
|
||||||
|
|
||||||
task = tasks.pop(task_id)
|
task = tasks.pop(task_id, None)
|
||||||
if not task:
|
if not task:
|
||||||
raise ValueError(f"Task with ID {task_id} not found.")
|
return {"status": False, "message": f"Task with ID {task_id} not found."}
|
||||||
|
|
||||||
task.cancel() # Request task cancellation
|
task.cancel() # Request task cancellation
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue