From 7bffe9ee50987a0fa6e25c2e28c587627318f138 Mon Sep 17 00:00:00 2001 From: Ben Thorner Date: Mon, 21 Mar 2022 15:41:59 +0000 Subject: [PATCH] Log Service ID when we get a duplicate receipt This will make it easier to group these logs if a service complains about the issue. --- app/dao/notifications_dao.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/dao/notifications_dao.py b/app/dao/notifications_dao.py index e2af29eb6..e9fc5bd30 100644 --- a/app/dao/notifications_dao.py +++ b/app/dao/notifications_dao.py @@ -775,15 +775,18 @@ def dao_precompiled_letters_still_pending_virus_check(): def _duplicate_update_warning(notification, status): current_app.logger.info( ( - 'Duplicate callback received. Notification id {id} received a status update to {new_status}' - ' from {old_status} for {type} sent by {sent_by}. This happened {time_diff} after being first set.' + 'Duplicate callback received for service {service_id}. ' + 'Notification ID {id} with type {type} sent by {sent_by}. ' + 'New status was {new_status}, current status is {old_status}. ' + 'This happened {time_diff} after being first set.' ).format( id=notification.id, old_status=notification.status, new_status=status, time_diff=datetime.utcnow() - (notification.updated_at or notification.created_at), type=notification.notification_type, - sent_by=notification.sent_by + sent_by=notification.sent_by, + service_id=notification.service_id ) )