mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-16 10:12:32 -05:00
avoid message is none scenario
This commit is contained in:
@@ -129,7 +129,8 @@ def deliver_sms(self, notification_id):
|
|||||||
)
|
)
|
||||||
# Code branches off to send_to_providers.py
|
# Code branches off to send_to_providers.py
|
||||||
message_id = send_to_providers.send_sms_to_provider(notification)
|
message_id = send_to_providers.send_sms_to_provider(notification)
|
||||||
update_notification_message_id(notification_id, message_id)
|
if message_id is not None: # can be none if technical failure happens
|
||||||
|
update_notification_message_id(notification_id, message_id)
|
||||||
|
|
||||||
# DEPRECATED
|
# DEPRECATED
|
||||||
# We have to put it in UTC. For other timezones, the delay
|
# We have to put it in UTC. For other timezones, the delay
|
||||||
|
|||||||
@@ -110,7 +110,6 @@ def _update_notification_status(
|
|||||||
return notification
|
return notification
|
||||||
|
|
||||||
|
|
||||||
@autocommit
|
|
||||||
def update_notification_message_id(notification_id, message_id):
|
def update_notification_message_id(notification_id, message_id):
|
||||||
stmt = (
|
stmt = (
|
||||||
update(Notification)
|
update(Notification)
|
||||||
@@ -118,6 +117,7 @@ def update_notification_message_id(notification_id, message_id):
|
|||||||
.values({"message_id": message_id})
|
.values({"message_id": message_id})
|
||||||
)
|
)
|
||||||
db.session.execute(stmt)
|
db.session.execute(stmt)
|
||||||
|
db.session.commit()
|
||||||
|
|
||||||
|
|
||||||
@autocommit
|
@autocommit
|
||||||
|
|||||||
Reference in New Issue
Block a user