File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -155,17 +155,8 @@ async def stop_task(redis, task_id: str):
155155 if not task :
156156 return {"status" : False , "message" : f"Task with ID { task_id } not found." }
157157
158- task .cancel () # Request task cancellation
159- try :
160- await task # Wait for the task to handle the cancellation
161- except asyncio .CancelledError :
162- # Task successfully canceled
163- return {"status" : True , "message" : f"Task { task_id } successfully stopped." }
164-
165- if task .cancelled () or task .done ():
166- return {"status" : True , "message" : f"Task { task_id } successfully cancelled." }
167-
168- return {"status" : True , "message" : f"Cancellation requested for { task_id } ." }
158+ task .cancel ()
159+ return {"status" : True , "message" : f"Task { task_id } cancellation requested." }
169160
170161
171162async def stop_item_tasks (redis : Redis , item_id : str ):
You can’t perform that action at this time.
0 commit comments