mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 23:55:58 -05:00
ensure that the celery workers know about the new db-letter queue
this fixes running locally and on paas, a separate PR is in notifications-aws to fix work on aws
This commit is contained in:
@@ -51,7 +51,7 @@ def process_job(job_id):
|
||||
|
||||
db_template = dao_get_template_by_id(job.template_id, job.template_version)
|
||||
|
||||
TemplateClass = get_template_class(db_template)
|
||||
TemplateClass = get_template_class(db_template.template_type)
|
||||
template = TemplateClass(db_template.__dict__)
|
||||
|
||||
for row_number, recipient, personalisation in RecipientCSV(
|
||||
@@ -266,10 +266,10 @@ def handle_exception(task, notification, notification_id, exc):
|
||||
current_app.logger.exception('Retry' + retry_msg)
|
||||
|
||||
|
||||
def get_template_class(template):
|
||||
if template.template_type == SMS_TYPE:
|
||||
def get_template_class(template_type):
|
||||
if template_type == SMS_TYPE:
|
||||
return SMSMessageTemplate
|
||||
elif template.template_type in (EMAIL_TYPE, LETTER_TYPE):
|
||||
elif template_type in (EMAIL_TYPE, LETTER_TYPE):
|
||||
# since we don't need rendering capabilities (we only need to extract placeholders) both email and letter can
|
||||
# use the same base template
|
||||
return WithSubjectTemplate
|
||||
|
||||
@@ -167,8 +167,9 @@ class Development(Config):
|
||||
SQLALCHEMY_ECHO = False
|
||||
CELERY_QUEUES = Config.CELERY_QUEUES + [
|
||||
Queue('db-sms', Exchange('default'), routing_key='db-sms'),
|
||||
Queue('send-sms', Exchange('default'), routing_key='send-sms'),
|
||||
Queue('db-email', Exchange('default'), routing_key='db-email'),
|
||||
Queue('db-letter', Exchange('default'), routing_key='db-letter'),
|
||||
Queue('send-sms', Exchange('default'), routing_key='send-sms'),
|
||||
Queue('send-email', Exchange('default'), routing_key='send-email'),
|
||||
Queue('research-mode', Exchange('default'), routing_key='research-mode')
|
||||
]
|
||||
@@ -186,8 +187,9 @@ class Test(Config):
|
||||
STATSD_PORT = 1000
|
||||
CELERY_QUEUES = Config.CELERY_QUEUES + [
|
||||
Queue('db-sms', Exchange('default'), routing_key='db-sms'),
|
||||
Queue('send-sms', Exchange('default'), routing_key='send-sms'),
|
||||
Queue('db-email', Exchange('default'), routing_key='db-email'),
|
||||
Queue('db-letter', Exchange('default'), routing_key='db-letter'),
|
||||
Queue('send-sms', Exchange('default'), routing_key='send-sms'),
|
||||
Queue('send-email', Exchange('default'), routing_key='send-email'),
|
||||
Queue('research-mode', Exchange('default'), routing_key='research-mode')
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user