mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-16 10:12:32 -05:00
Ensure that when an API call is made on
- a TEST key - a research-mode service We put the task into the research-mode queue NOT the production delivery queue.
This commit is contained in:
@@ -341,10 +341,17 @@ def persist_notification(
|
||||
)
|
||||
|
||||
try:
|
||||
research_mode = service.research_mode or key_type == KEY_TYPE_TEST
|
||||
if notification_type == SMS_TYPE:
|
||||
provider_tasks.deliver_sms.apply_async((str(notification_id)), queue='send-sms')
|
||||
provider_tasks.deliver_sms.apply_async(
|
||||
(str(notification_id)),
|
||||
queue='send-sms' if not research_mode else 'research-mode'
|
||||
)
|
||||
if notification_type == EMAIL_TYPE:
|
||||
provider_tasks.deliver_email.apply_async((str(notification_id)), queue='send-email')
|
||||
provider_tasks.deliver_email.apply_async(
|
||||
(str(notification_id)),
|
||||
queue='send-email' if not research_mode else 'research-mode'
|
||||
)
|
||||
except Exception as e:
|
||||
current_app.logger.exception("Failed to send to SQS exception", e)
|
||||
dao_delete_notifications_and_history_by_id(notification_id)
|
||||
|
||||
Reference in New Issue
Block a user