taskiq icon indicating copy to clipboard operation
taskiq copied to clipboard

Is it possible to revoke task?

Open aryadovoy opened this issue 2 years ago • 3 comments
trafficstars

Couldn't find any info about revoke function in docs.

aryadovoy avatar Jul 24 '23 07:07 aryadovoy

There's no such behavior. At this time. But actually, it would be nice to be able to do so. I wanted to implement it, but couldn't come up with general solution.

If you have any ideas, you can share them.

s3rius avatar Jul 24 '23 14:07 s3rius

This is very necessary. In fact. This is probably the only thing stopping me from using this library at the moment.

Exordio avatar Dec 11 '23 07:12 Exordio

In my app, I created an asyncio Task that I kept a record of, then listened for a cancellation event via pub/sub, then cancelled the Task. It's not the most elegant solution but it works really well for my application.

It would be nice to have a wrapper class for tasks that had a cancel member function. Alternatively, maybe it could follow the FastAPI-like-dependency-pattern where it yields then performs cleanup. Or just maybe something internally to keep track of the asyncio Tasks created, then a cancel function on the Taskiq Tasks.

kevinhikaruevans avatar Feb 27 '24 16:02 kevinhikaruevans