mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 07:35:34 -05:00
Fixing IntegrityError problems, again.
Signed-off-by: Cliff Hill <Clifford.hill@gsa.gov>
This commit is contained in:
@@ -214,9 +214,7 @@ def save_sms(self, service_id, notification_id, encrypted_notification, sender_i
|
|||||||
f"service not allowed to send for job_id {notification.get('job', None)}, aborting"
|
f"service not allowed to send for job_id {notification.get('job', None)}, aborting"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
current_app.logger.debug(
|
current_app.logger.debug(f"SMS {notification_id} failed as restricted service")
|
||||||
"SMS {} failed as restricted service".format(notification_id)
|
|
||||||
)
|
|
||||||
return
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -244,11 +242,12 @@ def save_sms(self, service_id, notification_id, encrypted_notification, sender_i
|
|||||||
reply_to_text=reply_to_text,
|
reply_to_text=reply_to_text,
|
||||||
)
|
)
|
||||||
except IntegrityError:
|
except IntegrityError:
|
||||||
if notification_exists(notification_id):
|
current_app.logger.warning(
|
||||||
saved_notification = get_notification(notification_id)
|
f"{NotificationType.SMS}: {notification_id} already exists."
|
||||||
|
)
|
||||||
else:
|
# If we don't have the return statement here, we will fall through and end
|
||||||
raise
|
# up retrying because IntegrityError is a subclass of SQLAlchemyError
|
||||||
|
return
|
||||||
|
|
||||||
# Kick off sns process in provider_tasks.py
|
# Kick off sns process in provider_tasks.py
|
||||||
sn = saved_notification
|
sn = saved_notification
|
||||||
|
|||||||
Reference in New Issue
Block a user