mirror of
https://github.com/GSA/notifications-api.git
synced 2026-05-05 16:48:31 -04:00
Sometimes a message is picked up twice of the SQS queue, we need to safe gaurd ourselves for that.
In this PR the id for the notification is passed in and used to created the notification, which causes a integrity error. Normally when we get a SQLAlchemy error here we send the message to the retry queue, but if the notification already exists we just ignore it.
This commit is contained in:
@@ -4,7 +4,7 @@ from flask import current_app
|
||||
from notifications_utils.renderers import PassThrough
|
||||
from notifications_utils.template import Template
|
||||
|
||||
from app import DATETIME_FORMAT, redis_store
|
||||
from app import redis_store
|
||||
from app.celery import provider_tasks
|
||||
from app.clients import redis
|
||||
from app.dao.notifications_dao import dao_create_notification, dao_delete_notifications_and_history_by_id
|
||||
@@ -48,8 +48,10 @@ def persist_notification(template_id,
|
||||
created_at=None,
|
||||
job_id=None,
|
||||
job_row_number=None,
|
||||
reference=None):
|
||||
reference=None,
|
||||
notification_id=None):
|
||||
notification = Notification(
|
||||
id=notification_id,
|
||||
template_id=template_id,
|
||||
template_version=template_version,
|
||||
to=recipient,
|
||||
|
||||
Reference in New Issue
Block a user