Is it possible to skip delegating a celery task if the params and the task name is already queued in the server?

Viewed 1719

Say that I have this task:

def do_stuff_for_some_time(some_id):
    e = Model.objects.get(id=some_id)
    e.domanystuff()

and I'm using it like so:

do_stuff_for_some_time.apply_async(args=[some_id], queue='some_queue')

The problem I'm facing is that there are a lot of repetitive tasks with the same arg param and it's boggling down the queue.

Is it possible to apply async only if the same args and the same task is not in the queue?

3 Answers
Related