mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-20 15:31:15 -05:00
Merge branch 'master' into month-billing-table
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
from flask import Blueprint, jsonify
|
||||
|
||||
from app.celery import QueueNames
|
||||
from app.config import QueueNames
|
||||
from app.delivery import send_to_providers
|
||||
from app.models import EMAIL_TYPE
|
||||
from app.celery import provider_tasks
|
||||
@@ -24,16 +24,20 @@ def send_notification_to_provider(notification_id):
|
||||
send_response(
|
||||
send_to_providers.send_email_to_provider,
|
||||
provider_tasks.deliver_email,
|
||||
notification)
|
||||
notification,
|
||||
QueueNames.SEND_EMAIL
|
||||
)
|
||||
else:
|
||||
send_response(
|
||||
send_to_providers.send_sms_to_provider,
|
||||
provider_tasks.deliver_sms,
|
||||
notification)
|
||||
notification,
|
||||
QueueNames.SEND_SMS
|
||||
)
|
||||
return jsonify({}), 204
|
||||
|
||||
|
||||
def send_response(send_call, task_call, notification):
|
||||
def send_response(send_call, task_call, notification, queue):
|
||||
try:
|
||||
send_call(notification)
|
||||
except Exception as e:
|
||||
@@ -42,4 +46,4 @@ def send_response(send_call, task_call, notification):
|
||||
notification.id,
|
||||
notification.notification_type),
|
||||
e)
|
||||
task_call.apply_async((str(notification.id)), queue=QueueNames.SEND)
|
||||
task_call.apply_async((str(notification.id)), queue=queue)
|
||||
|
||||
Reference in New Issue
Block a user