Ensures that both the CSV processing and the API both use the new deliver_email and deliver_sms tasks not the old ones with the redundant parameter.

This commit is contained in:
Martyn Inglis
2016-09-28 15:05:50 +01:00
parent 9233ffa3d4
commit c13ead77e4
5 changed files with 106 additions and 115 deletions

View File

@@ -16,7 +16,7 @@ from app import (
encryption
)
from app.aws import s3
from app.celery.provider_tasks import send_sms_to_provider, send_email_to_provider
from app.celery import provider_tasks
from app.dao.jobs_dao import (
dao_update_job,
dao_get_job_by_id
@@ -131,7 +131,7 @@ def send_sms(self,
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='send-sms')
provider_tasks.deliver_sms.apply_async((notification_id), queue='send-sms')
current_app.logger.info(
"SMS {} created at {}".format(notification_id, created_at)
@@ -170,7 +170,7 @@ def send_email(self, service_id,
)
)
send_email_to_provider.apply_async((service_id, notification_id), queue='send-email')
provider_tasks.deliver_email.apply_async((notification_id), queue='send-email')
current_app.logger.info("Email {} created at {}".format(notification_id, created_at))
except SQLAlchemyError as e:

View File

@@ -46,7 +46,7 @@ from app.errors import (
)
register_errors(notifications)
from app.celery.provider_tasks import send_sms_to_provider, send_email_to_provider
from app.celery import provider_tasks
@notifications.route('/notifications/email/ses', methods=['POST'])
@@ -342,9 +342,9 @@ def persist_notification(
try:
if notification_type == SMS_TYPE:
send_sms_to_provider.apply_async((str(service.id), str(notification_id)), queue='send-sms')
provider_tasks.deliver_sms.apply_async((str(notification_id)), queue='send-sms')
if notification_type == EMAIL_TYPE:
send_email_to_provider.apply_async((str(service.id), str(notification_id)), queue='send-email')
provider_tasks.deliver_email.apply_async((str(notification_id)), queue='send-email')
except Exception as e:
current_app.logger.exception("Failed to send to SQS exception", e)
dao_delete_notifications_and_history_by_id(notification_id)