Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Celery workers take 5 jobs immediately despite telling them not to

Tags:

python

celery

I start my celery workers with

celery -A workerTasks worker --concurrency 1

In django's settings.py I also have:

CELERYD_PREFETCH_MULTIPLIER = 1
CELERY_worker_prefetch_multiplier = 1

But the workers still consume 5 tasks as soon as they connect to the celery broker.

What am I missing?

like image 951
Omroth Avatar asked Dec 14 '25 18:12

Omroth


1 Answers

Ok,so my mistake was that I was setting the config on the server-side rather than the worker-side. When creating the Celery app I can set the configuration explicitly like this:

app = Celery('workerTasks', broker='whatever')


app.conf['worker_prefetch_multiplier'] = 1
like image 131
Omroth Avatar answered Dec 17 '25 07:12

Omroth



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!