Reputation: 8821
I want to put a task to celery, but I want the task is executed after 30 seconds instead of executed immediately.
For example:
@celery.task
def task():
# waiting 30 seconds
do something....
I can use it to make it: sleep(30)
, but is there any better solution?
Upvotes: 0
Views: 239
Reputation: 36201
The best way would be for that task's task to be to schedule the real task in 30 seconds. Something like that:
@celery.task
def task():
RealTask.apply_async(countdown=30)
Upvotes: 2