Refactor process_ses_receipt

It is possible a service has data rention that is smaller than the time it takes to get a delivery receipt.
This PR refactors process_ses_receipt to update NotificationHistory if the Notifcation has already been purged.
This commit is contained in:
Rebecca Law
2020-03-27 14:12:39 +00:00
parent 8da73510c2
commit 46b72a6bbb
4 changed files with 28 additions and 24 deletions

View File

@@ -303,7 +303,6 @@ def save_api_email(self,
service = dao_fetch_service_by_id(notification['service_id'])
try:
current_app.logger.info(f"Persisting notification {notification['id']}")
persist_notification(
notification_id=notification["id"],
@@ -327,7 +326,7 @@ def save_api_email(self,
[notification['id']],
queue=q
)
current_app.logger.info(f"Email {notification['id']} has been persisted.")
current_app.logger.info(f"Email {notification['id']} has been persisted and sent to delivery queue.")
except IntegrityError:
current_app.logger.info(f"Email {notification['id']} already exists.")