mirror of
https://github.com/open-webui/open-webui.git
synced 2026-09-28 02:07:05 -04:00
refac
This commit is contained in:
@@ -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.'}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user