mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-30 14:31:57 -05:00
Add new failure status for notifications.
This commit is contained in:
@@ -86,6 +86,9 @@ def delete_failed_notifications():
|
||||
try:
|
||||
start = datetime.utcnow()
|
||||
deleted = delete_notifications_created_more_than_a_week_ago('failed')
|
||||
deleted += delete_notifications_created_more_than_a_week_ago('technical-failure')
|
||||
deleted += delete_notifications_created_more_than_a_week_ago('temporary-failure')
|
||||
deleted += delete_notifications_created_more_than_a_week_ago('permanent-failure')
|
||||
current_app.logger.info(
|
||||
"Delete job started {} finished {} deleted {} failed notifications".format(
|
||||
start,
|
||||
@@ -264,7 +267,7 @@ def send_sms(service_id, notification_id, encrypted_notification, created_at):
|
||||
"SMS notification {} failed".format(notification_id)
|
||||
)
|
||||
current_app.logger.exception(e)
|
||||
notification_db_object.status = 'failed'
|
||||
notification_db_object.status = 'technical-failure'
|
||||
|
||||
dao_update_notification(notification_db_object)
|
||||
current_app.logger.info(
|
||||
@@ -334,7 +337,7 @@ def send_email(service_id, notification_id, from_address, encrypted_notification
|
||||
|
||||
except EmailClientException as e:
|
||||
current_app.logger.exception(e)
|
||||
notification_db_object.status = 'failed'
|
||||
notification_db_object.status = 'technical-failure'
|
||||
dao_update_notification(notification_db_object)
|
||||
|
||||
current_app.logger.info(
|
||||
|
||||
@@ -306,7 +306,7 @@ class VerifyCode(db.Model):
|
||||
|
||||
|
||||
NOTIFICATION_STATUS_TYPES = ['sending', 'delivered', 'failed',
|
||||
'technical_failure', 'temporary_failure', 'permanent_failure']
|
||||
'technical-failure', 'temporary-failure', 'permanent-failure']
|
||||
|
||||
|
||||
class Notification(db.Model):
|
||||
|
||||
Reference in New Issue
Block a user