construct celery queues once in the base config

previously, we were confusing things by appending to CELERY_QUEUES in
both dev and test configs - these are executed at import time, so the
list contained all queues twice, regardless of what config you're
actually using.

Fortunately, the -Q command that we supply the workers with overrides
this config option, so other environments weren't affected. Given that,
we can tidy up this code by just declaring it in the base config every
time
This commit is contained in:
Leo Hemsted
2017-12-28 12:04:19 +00:00
committed by Ben Thorner
parent c2fe1b04bb
commit 19394ab9dd

View File

@@ -336,7 +336,9 @@ class Config(object):
'options': {'queue': QueueNames.PERIODIC}
},
}
CELERY_QUEUES = []
# this is overriden by the -Q command, but locally, we should read from all queues
CELERY_QUEUES = [Queue(queue, Exchange('default'), routing_key=queue) for queue in QueueNames.all_queues()]
FROM_NUMBER = 'development'
@@ -427,11 +429,6 @@ class Development(Config):
ANTIVIRUS_ENABLED = os.getenv('ANTIVIRUS_ENABLED') == '1'
for queue in QueueNames.all_queues():
Config.CELERY_QUEUES.append(
Queue(queue, Exchange('default'), routing_key=queue)
)
API_HOST_NAME = "http://localhost:6011"
API_RATE_LIMIT_ENABLED = True
DVLA_EMAIL_ADDRESSES = ['success@simulator.amazonses.com']
@@ -469,11 +466,6 @@ class Test(Development):
ANTIVIRUS_ENABLED = True
for queue in QueueNames.all_queues():
Config.CELERY_QUEUES.append(
Queue(queue, Exchange('default'), routing_key=queue)
)
API_RATE_LIMIT_ENABLED = True
API_HOST_NAME = "http://localhost:6011"