mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-15 01:32:20 -05:00
In event of a task retry ensure the log message is identifier as such
- "RETRY" prefixes the messages In event of the retry attempts completing without successfully completing the task identify message as such - "RETRY FAILED" prefixes the messages Applies to the send_sms|send_email and send_sms_to_provider|send_email_to_provider tasks These are there to try and ensure we can alert on these events so that we know if we have started retrying messages Retry messages also contain notification ids to aid debugging.
This commit is contained in:
@@ -154,8 +154,14 @@ def send_sms(self,
|
||||
)
|
||||
|
||||
except SQLAlchemyError as e:
|
||||
current_app.logger.exception(e)
|
||||
raise self.retry(queue="retry", exc=e)
|
||||
current_app.logger.exception("RETRY: send_sms notification {}".format(notification_id), e)
|
||||
try:
|
||||
raise self.retry(queue="retry", exc=e)
|
||||
except self.MaxRetriesExceededError:
|
||||
current_app.logger.exception(
|
||||
"RETRY FAILED: task send_sms failed for notification {}".format(notification.id),
|
||||
e
|
||||
)
|
||||
|
||||
|
||||
@notify_celery.task(bind=True, name="send-email", max_retries=5, default_retry_delay=300)
|
||||
@@ -180,8 +186,14 @@ def send_email(self, service_id,
|
||||
|
||||
current_app.logger.info("Email {} created at {}".format(notification_id, created_at))
|
||||
except SQLAlchemyError as e:
|
||||
current_app.logger.exception(e)
|
||||
raise self.retry(queue="retry", exc=e)
|
||||
current_app.logger.exception("RETRY: send_email notification {}".format(notification_id), e)
|
||||
try:
|
||||
raise self.retry(queue="retry", exc=e)
|
||||
except self.MaxRetriesExceededError:
|
||||
current_app.logger.error(
|
||||
"RETRY FAILED: task send_email failed for notification {}".format(notification.id),
|
||||
e
|
||||
)
|
||||
|
||||
|
||||
def _save_notification(created_at, notification, notification_id, service_id, notification_type, api_key_id, key_type):
|
||||
|
||||
Reference in New Issue
Block a user