mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-20 15:31:15 -05:00
Use the new task wrapper methods rather than creating a task directly
This commit is contained in:
@@ -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)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user