taskiq
taskiq copied to clipboard
Is it possible to revoke task?
Couldn't find any info about revoke function in docs.
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.
This is very necessary. In fact. This is probably the only thing stopping me from using this library at the moment.
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.