mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-16 02:02:13 -05:00
Provider stats only updated if the provider successfully sends the message.
This commit is contained in:
@@ -36,7 +36,7 @@ from app.dao.notifications_dao import (
|
||||
dao_update_notification,
|
||||
delete_notifications_created_more_than_a_week_ago,
|
||||
dao_get_notification_statistics_for_service_and_day,
|
||||
update_notification_reference_by_id
|
||||
update_notification_after_sent_to_provider
|
||||
)
|
||||
|
||||
from app.dao.jobs_dao import (
|
||||
@@ -262,6 +262,12 @@ def send_sms(service_id, notification_id, encrypted_notification, created_at):
|
||||
reference=str(notification_id)
|
||||
)
|
||||
|
||||
update_notification_after_sent_to_provider(
|
||||
notification_id,
|
||||
'sms',
|
||||
provider.get_name()
|
||||
)
|
||||
|
||||
except SmsClientException as e:
|
||||
current_app.logger.error(
|
||||
"SMS notification {} failed".format(notification_id)
|
||||
@@ -331,7 +337,12 @@ def send_email(service_id, notification_id, from_address, encrypted_notification
|
||||
reply_to_addresses=reply_to_addresses,
|
||||
)
|
||||
|
||||
update_notification_reference_by_id(notification_id, reference)
|
||||
update_notification_after_sent_to_provider(
|
||||
notification_id,
|
||||
'email',
|
||||
provider.get_name(),
|
||||
reference=reference
|
||||
)
|
||||
|
||||
except EmailClientException as e:
|
||||
current_app.logger.exception(e)
|
||||
|
||||
Reference in New Issue
Block a user