Django + Celery Task receive issue.

Hello,

I have an issue with my celery.

this is my celery configuration.

import os
from celery import Celery

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'prune.settings')

app = Celery('prune')
app.config_from_object('django.conf.settings', namespace='CELERY')
app.autodiscover_tasks()

this is my celery task

@shared_task
def delete_delivery_instance(instance_id):
    try:
        instance = DeliveryBoyLocation.objects.get(id =instance_id)
        instance.delete()
        return True
    except Exception as e:
        print(e,"delete_delivery_instance_error")
        return False

and this is for sending tasks to celery, run in 5 min.

delete_delivery_instance.apply_async(args=[deliverylocation.id], countdown=300)

using this command to run celery in my linux services

celery -A prune worker --loglevel=info --pool=threads -c 4 

I tried so many run celery commands but still faced issues.

the issue is that I sending 10 tasks to the celery but celery has received only 3-4 task
sometimes it takes 6-7 but celery does not take each task.

is there any configuration or setting that I miss to implement please guide me.

I’m using rabbitmq server as a message queue

Please be more detailed and specific with this description.

Are you saying that your code is calling delete_delivery_instance.apply_async(...) 10 times? How have you verified that?

Then is celery showing that it has received 10 messages? (or not) How are you verifying this?

Are you getting any error messages in either your celery logs or your application’s logs?