mirror of
https://github.com/open-webui/open-webui.git
synced 2026-09-11 22:52:54 +00:00
refac
This commit is contained in:
parent
44f9a4f7f9
commit
e35b907f73
1 changed files with 4 additions and 4 deletions
|
|
@ -274,10 +274,10 @@ async def stop_item_tasks(redis: Redis, item_id: str):
|
|||
if not task_ids:
|
||||
return {'status': True, 'message': f'No tasks found for item {item_id}.'}
|
||||
|
||||
for task_id in task_ids:
|
||||
result = await stop_task(redis, task_id)
|
||||
if not result['status']:
|
||||
return result # Return the first failure
|
||||
# Cleanup mutates the local task list while cancellation is awaited.
|
||||
for task_id in list(task_ids):
|
||||
# A task that already finished needs no stopping; continue with the rest.
|
||||
await stop_task(redis, task_id)
|
||||
|
||||
return {'status': True, 'message': f'All tasks for item {item_id} stopped.'}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue