mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-24 01:11:38 -05:00
This massive set of changes uses the new queue names object throughout the app and tests.
Lots of changes, all changing the line of code that puts things into queues, and the code that tests that.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
from flask import Blueprint, jsonify
|
||||
|
||||
from app.config import QueueNames
|
||||
from app.delivery import send_to_providers
|
||||
from app.models import EMAIL_TYPE
|
||||
from app.celery import provider_tasks
|
||||
@@ -23,18 +24,16 @@ def send_notification_to_provider(notification_id):
|
||||
send_response(
|
||||
send_to_providers.send_email_to_provider,
|
||||
provider_tasks.deliver_email,
|
||||
notification,
|
||||
'send-email')
|
||||
notification)
|
||||
else:
|
||||
send_response(
|
||||
send_to_providers.send_sms_to_provider,
|
||||
provider_tasks.deliver_sms,
|
||||
notification,
|
||||
'send-sms')
|
||||
notification)
|
||||
return jsonify({}), 204
|
||||
|
||||
|
||||
def send_response(send_call, task_call, notification, queue):
|
||||
def send_response(send_call, task_call, notification):
|
||||
try:
|
||||
send_call(notification)
|
||||
except Exception as e:
|
||||
@@ -43,4 +42,4 @@ def send_response(send_call, task_call, notification, queue):
|
||||
notification.id,
|
||||
notification.notification_type),
|
||||
e)
|
||||
task_call.apply_async((str(notification.id)), queue=queue)
|
||||
task_call.apply_async((str(notification.id)), queue=QueueNames.SEND)
|
||||
|
||||
Reference in New Issue
Block a user