New queues for the sms/email tasks

Previously there were 4 queues for sending messages

The was based on the fact that each notification has 2 actions - persist in the database and send to provider.

Two queues supported the CSV upload - for the first of these tasks
- bulk-email
- build-sms

And there were two more queues for the tasks that make the 3rd party client calls.
- sms
- email

API Calls just used the latter two queues for both tasks

Added four new queues
- db-email
- db-sms
- send-sms
- send-email

So an API call puts a notification into the db-[type] queue first, which then puts the notification into the send-[type] queue

Build queues stay as before.

This will allow us to target processing of these tasks with separate workers to manage these differently.
This commit is contained in:
Martyn Inglis
2016-08-30 10:42:24 +01:00
parent 58a89a3a80
commit 486697d07c
5 changed files with 20 additions and 16 deletions

View File

@@ -295,7 +295,7 @@ def test_should_send_template_to_correct_sms_task_and_persist(sample_template_wi
provider_tasks.send_sms_to_provider.apply_async.assert_called_once_with(
(sample_template_with_placeholders.service_id,
notification_id),
queue="sms"
queue="send-sms"
)
persisted_notification = Notification.query.filter_by(id=notification_id).one()
@@ -333,7 +333,7 @@ def test_should_send_sms_if_restricted_service_and_valid_number(notify_db, notif
provider_tasks.send_sms_to_provider.apply_async.assert_called_once_with(
(service.id,
notification_id),
queue="sms"
queue="send-sms"
)
persisted_notification = Notification.query.filter_by(id=notification_id).one()
@@ -410,7 +410,7 @@ def test_should_send_sms_template_to_and_persist_with_job_id(sample_job, sample_
provider_tasks.send_sms_to_provider.apply_async.assert_called_once_with(
(sample_job.service.id,
notification_id),
queue="sms"
queue="send-sms"
)
persisted_notification = Notification.query.filter_by(id=notification_id).one()
assert persisted_notification.id == notification_id
@@ -452,7 +452,7 @@ def test_should_use_email_template_and_persist(sample_email_template_with_placeh
persisted_notification = Notification.query.filter_by(id=notification_id).one()
provider_tasks.send_email_to_provider.apply_async.assert_called_once_with(
(sample_email_template_with_placeholders.service_id, notification_id), queue='email')
(sample_email_template_with_placeholders.service_id, notification_id), queue='send-email')
assert persisted_notification.id == notification_id
assert persisted_notification.to == 'my_email@my_email.com'
@@ -490,7 +490,7 @@ def test_send_email_should_use_template_version_from_job_not_latest(sample_email
)
provider_tasks.send_email_to_provider.apply_async.assert_called_once_with((sample_email_template.service_id,
notification_id), queue='email')
notification_id), queue='send-email')
persisted_notification = Notification.query.filter_by(id=notification_id).one()
assert persisted_notification.id == notification_id
@@ -518,7 +518,7 @@ def test_should_use_email_template_subject_placeholders(sample_email_template_wi
now.strftime(DATETIME_FORMAT)
)
provider_tasks.send_email_to_provider.apply_async.assert_called_once_with(
(sample_email_template_with_placeholders.service_id, notification_id, ), queue='email'
(sample_email_template_with_placeholders.service_id, notification_id, ), queue='send-email'
)
persisted_notification = Notification.query.filter_by(id=notification_id).one()
assert persisted_notification.id == notification_id
@@ -545,7 +545,7 @@ def test_should_use_email_template_and_persist_without_personalisation(sample_em
now.strftime(DATETIME_FORMAT)
)
provider_tasks.send_email_to_provider.apply_async.assert_called_once_with((sample_email_template.service_id,
notification_id), queue='email')
notification_id), queue='send-email')
persisted_notification = Notification.query.filter_by(id=notification_id).one()
assert persisted_notification.id == notification_id