Django + Celery Task receive issue.


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')

this is my celery task

def delete_delivery_instance(instance_id):
        instance = DeliveryBoyLocation.objects.get(id =instance_id)
        return True
    except Exception as e:
        return False

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

delete_delivery_instance.apply_async(args=[], 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?