'Django celery apply_async running multiple times

Using Django 2.2 and Celery 4.4.7.

Using AWS ECS to deploy the application and celery and using SQS as message broker.

In the ECS task definition, using the following command to start the celery task

["celery","worker","-A","app","-l","info","--concurrency","4"]

There are 8 tasks running for the celery service and 4 tasks for the application

enter image description here

When using apply_async to delay a task

send_webhook_task.apply_async(
    kwargs={
        'tracking_id': tracking_data.id,
        'hook_url': hook.url
    },
    countdown=60
)

The above task is executed after 60 seconds, but it executes for 3-4 times and the same data is sent multiple times.

Same when using delay() is executed only once

send_webhook_task.delay(
    tracking_id=tracking_data.id,
    hook_url=hook.url
)

Why apply_sync is executing multiple times with the above setup?

Celery broker settings

CELERY_BROKER_TRANSPORT_OPTIONS = {
    'visibility_timeout': 1500,
    'polling_interval': 60
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source