mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-14 17:22:17 -05:00
Cast Celery worker_max_tasks_per_child to int or None
We use this config option when running workers that process non-memory-safe tasks to restart the worker after n tasks. Celery 5 requires this to be passed as an int or None. Signed-off-by: Richard Baker <richard.baker@digital.cabinet-office.gov.uk>
This commit is contained in:
committed by
Ben Thorner
parent
9e9091e980
commit
e10f45b3a7
@@ -195,8 +195,6 @@ class Config(object):
|
||||
'queue_name_prefix': NOTIFICATION_QUEUE_PREFIX,
|
||||
},
|
||||
'timezone': 'Europe/London',
|
||||
# on reporting worker, restart workers after each task is executed to help prevent memory leaks
|
||||
'worker_max_tasks_per_child': os.getenv('CELERYD_MAX_TASKS_PER_CHILD'),
|
||||
'imports': [
|
||||
'app.celery.tasks',
|
||||
'app.celery.scheduled_tasks',
|
||||
@@ -340,6 +338,10 @@ class Config(object):
|
||||
if os.getenv('CELERYD_PREFETCH_MULTIPLIER'):
|
||||
CELERY['worker_prefetch_multiplier'] = os.getenv('CELERYD_PREFETCH_MULTIPLIER')
|
||||
|
||||
# on reporting worker, restart workers after each task is executed to help prevent memory leaks
|
||||
if os.getenv('CELERYD_MAX_TASKS_PER_CHILD'):
|
||||
CELERY['worker_max_tasks_per_child'] = int(os.getenv('CELERYD_MAX_TASKS_PER_CHILD'))
|
||||
|
||||
FROM_NUMBER = 'development'
|
||||
|
||||
STATSD_HOST = os.getenv('STATSD_HOST')
|
||||
|
||||
Reference in New Issue
Block a user