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

@@ -147,7 +147,7 @@ def send_sms(self,
try:
_save_notification(created_at, notification, notification_id, service_id, SMS_TYPE, api_key_id, key_type)
send_sms_to_provider.apply_async((service_id, notification_id), queue='sms')
send_sms_to_provider.apply_async((service_id, notification_id), queue='send-sms')
current_app.logger.info(
"SMS {} created at {}".format(notification_id, created_at)
@@ -182,7 +182,7 @@ def send_email(self, service_id,
try:
_save_notification(created_at, notification, notification_id, service_id, EMAIL_TYPE, api_key_id, key_type)
send_email_to_provider.apply_async((service_id, notification_id), queue='email')
send_email_to_provider.apply_async((service_id, notification_id), queue='send-email')
current_app.logger.info("Email {} created at {}".format(notification_id, created_at))
except SQLAlchemyError as e: