Skip to content

Commit

Permalink
Merge pull request #1450 from GSA/notify-api-1430
Browse files Browse the repository at this point in the history
fix notification insert retry logic
  • Loading branch information
ccostino authored Dec 2, 2024
2 parents 6246684 + 6124fbc commit 7a90722
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions app/celery/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,15 +346,19 @@ def save_api_email_or_sms(self, encrypted_notification):
status=notification["status"],
document_download_count=notification["document_download_count"],
)

# Only get here if save to the db was successful (i.e. first time)
provider_task.apply_async([notification["id"]], queue=q)
current_app.logger.debug(
f"{notification['notification_type']} {notification['id']} has been persisted and sent to delivery queue."
)

except IntegrityError:
current_app.logger.info(
current_app.logger.warning(
f"{notification['notification_type']} {notification['id']} already exists."
)
# If we don't have the return statement here, we will fall through and end
# up retrying because IntegrityError is a subclass of SQLAlchemyError
return

except SQLAlchemyError:
try:
Expand Down

0 comments on commit 7a90722

Please sign in to comment.