mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-02 17:31:14 -05:00
Auto switch providers if exception is returned on sms delivery
This commit is contained in:
@@ -5,6 +5,7 @@ from sqlalchemy.orm.exc import NoResultFound
|
||||
from app import notify_celery
|
||||
from app.dao import notifications_dao
|
||||
from app.dao.notifications_dao import update_notification_status_by_id
|
||||
from app.dao.provider_details_dao import dao_toggle_sms_provider
|
||||
from app.statsd_decorators import statsd
|
||||
from app.delivery import send_to_providers
|
||||
|
||||
@@ -43,6 +44,7 @@ def deliver_sms(self, notification_id):
|
||||
send_to_providers.send_sms_to_provider(notification)
|
||||
except Exception as e:
|
||||
try:
|
||||
dao_toggle_sms_provider()
|
||||
current_app.logger.exception(
|
||||
"RETRY: SMS notification {} failed".format(notification_id)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user