I need to have a celery task run after a countdown, but be able to reset that countdown under certain conditions. For example, I want to call apply_async
with countdown=15
, but if certain event occurs before the task is executed, I'd like to set that countdown to 15 seconds again.
From the docs and googling I think I could accomplish this by saving the task id, and then revoking and recreating the task if the event occurs. I was wondering if there's a more elegant approach to it.
Instead of setting the countdown can't you just revoke this task and create a new one?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With