Use the new task wrapper methods rather than creating a task directly

This commit is contained in:
Martyn Inglis
2017-05-09 18:17:55 +01:00
parent f2a47044a4
commit caed193647
4 changed files with 145 additions and 36 deletions

View File

@@ -18,6 +18,8 @@ from app.dao.templates_dao import dao_get_template_by_id
from app.models import SMS_TYPE, KEY_TYPE_TEST, BRANDING_ORG, EMAIL_TYPE, NOTIFICATION_TECHNICAL_FAILURE, \
NOTIFICATION_SENT, NOTIFICATION_SENDING
from app.celery.statistics_tasks import record_initial_job_statistics, create_initial_notification_statistic_tasks
def send_sms_to_provider(notification):
service = notification.service
@@ -57,6 +59,8 @@ def send_sms_to_provider(notification):
notification.billable_units = template.fragment_count
update_notification(notification, provider, notification.international)
create_initial_notification_statistic_tasks(notification)
current_app.logger.info(
"SMS {} sent to provider {} at {}".format(notification.id, provider.get_name(), notification.sent_at)
)
@@ -107,6 +111,8 @@ def send_email_to_provider(notification):
notification.reference = reference
update_notification(notification, provider)
create_initial_notification_statistic_tasks(notification)
current_app.logger.info(
"Email {} sent to provider at {}".format(notification.id, notification.sent_at)
)