From ac445114c767755efb3812aeeaf50ad0ac77151a Mon Sep 17 00:00:00 2001 From: Martyn Inglis Date: Tue, 4 Apr 2017 13:44:11 +0100 Subject: [PATCH] When using a priority template put the notification in the priority queue. - there is now a dedicated worker to handle priority queues. We don't now bundle this in the default worker. --- app/notifications/rest.py | 2 +- app/v2/notifications/post_notifications.py | 2 +- tests/app/notifications/rest/test_send_notification.py | 2 +- tests/app/v2/notifications/test_post_notifications.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/notifications/rest.py b/app/notifications/rest.py index 4aa6283c1..57e1efeed 100644 --- a/app/notifications/rest.py +++ b/app/notifications/rest.py @@ -131,7 +131,7 @@ def send_notification(notification_type): key_type=api_user.key_type, simulated=simulated) if not simulated: - queue_name = 'notify' if template.process_type == PRIORITY else None + queue_name = 'priority' if template.process_type == PRIORITY else None send_notification_to_queue(notification=notification_model, research_mode=service.research_mode, queue=queue_name) diff --git a/app/v2/notifications/post_notifications.py b/app/v2/notifications/post_notifications.py index 6b0f59ec1..c3cbfdabf 100644 --- a/app/v2/notifications/post_notifications.py +++ b/app/v2/notifications/post_notifications.py @@ -50,7 +50,7 @@ def post_notification(notification_type): reference=form.get('reference', None), simulated=simulated) if not simulated: - queue_name = 'notify' if template.process_type == PRIORITY else None + queue_name = 'priority' if template.process_type == PRIORITY else None send_notification_to_queue(notification=notification, research_mode=service.research_mode, queue=queue_name) else: current_app.logger.info("POST simulated notification for id: {}".format(notification.id)) diff --git a/tests/app/notifications/rest/test_send_notification.py b/tests/app/notifications/rest/test_send_notification.py index cde289b58..7c90f0c99 100644 --- a/tests/app/notifications/rest/test_send_notification.py +++ b/tests/app/notifications/rest/test_send_notification.py @@ -1022,4 +1022,4 @@ def test_send_notification_uses_priority_queue_when_template_is_marked_as_priori notification_id = response_data['notification']['id'] assert response.status_code == 201 - mocked.assert_called_once_with([notification_id], queue='notify') + mocked.assert_called_once_with([notification_id], queue='priority') diff --git a/tests/app/v2/notifications/test_post_notifications.py b/tests/app/v2/notifications/test_post_notifications.py index 8ad0204e8..bf15dd8e3 100644 --- a/tests/app/v2/notifications/test_post_notifications.py +++ b/tests/app/v2/notifications/test_post_notifications.py @@ -223,4 +223,4 @@ def test_send_notification_uses_priority_queue_when_template_is_marked_as_priori notification_id = json.loads(response.data)['id'] assert response.status_code == 201 - mocked.assert_called_once_with([notification_id], queue='notify') + mocked.assert_called_once_with([notification_id], queue='priority')