From 77d1bc73b59d534881f1271cba9ec72ca71215c0 Mon Sep 17 00:00:00 2001 From: Rebecca Law Date: Tue, 23 Oct 2018 13:59:52 +0100 Subject: [PATCH 1/3] Added inbound_sms_id to log output, the extra information may help when trying to help debug an issue. --- app/celery/tasks.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/celery/tasks.py b/app/celery/tasks.py index 32932b320..70c72412a 100644 --- a/app/celery/tasks.py +++ b/app/celery/tasks.py @@ -274,10 +274,10 @@ def save_email(self, @notify_celery.task(bind=True, name="save-letter", max_retries=5, default_retry_delay=300) @statsd(namespace="tasks") def save_letter( - self, - service_id, - notification_id, - encrypted_notification, + self, + service_id, + notification_id, + encrypted_notification, ): notification = encryption.decrypt(encrypted_notification) @@ -536,7 +536,8 @@ def send_inbound_sms_to_service(self, inbound_sms_id, service_id): response.raise_for_status() except RequestException as e: current_app.logger.warning( - "send_inbound_sms_to_service request failed for service_id: {} and url: {}. exc: {}".format( + "send_inbound_sms_to_service failed for service_id: {} for inbound_sms_id: {} and url: {}. exc: {}".format( + inbound_sms_id, service_id, inbound_api.url, e @@ -570,7 +571,6 @@ def process_incomplete_jobs(job_ids): def process_incomplete_job(job_id): - job = dao_get_job_by_id(job_id) last_notification_added = dao_get_last_notification_added_for_job_id(job_id) From 5459009f5ac355b5f9ff1072d0db4b254046b913 Mon Sep 17 00:00:00 2001 From: Rebecca Law Date: Wed, 24 Oct 2018 16:19:17 +0100 Subject: [PATCH 2/3] Switch order of service and inbound_sms_id in message. Added service id to retry message --- app/celery/tasks.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/celery/tasks.py b/app/celery/tasks.py index 70c72412a..68976d9bc 100644 --- a/app/celery/tasks.py +++ b/app/celery/tasks.py @@ -537,8 +537,8 @@ def send_inbound_sms_to_service(self, inbound_sms_id, service_id): except RequestException as e: current_app.logger.warning( "send_inbound_sms_to_service failed for service_id: {} for inbound_sms_id: {} and url: {}. exc: {}".format( - inbound_sms_id, service_id, + inbound_sms_id, inbound_api.url, e ) @@ -548,7 +548,9 @@ def send_inbound_sms_to_service(self, inbound_sms_id, service_id): self.retry(queue=QueueNames.RETRY) except self.MaxRetriesExceededError: current_app.logger.error( - 'Retry: send_inbound_sms_to_service has retried the max number of times for inbound_sms {}'.format( + """Retry: send_inbound_sms_to_service has retried the max number of + times for service: {} and inbound_sms {}""".format( + service_id, inbound_sms_id ) ) From 9ee55155ccf1cf6c70d5123da4a4bf68d3a8d9f9 Mon Sep 17 00:00:00 2001 From: Rebecca Law Date: Wed, 24 Oct 2018 16:37:38 +0100 Subject: [PATCH 3/3] Add service id to log --- app/celery/tasks.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/celery/tasks.py b/app/celery/tasks.py index 68976d9bc..290a19a0c 100644 --- a/app/celery/tasks.py +++ b/app/celery/tasks.py @@ -548,8 +548,8 @@ def send_inbound_sms_to_service(self, inbound_sms_id, service_id): self.retry(queue=QueueNames.RETRY) except self.MaxRetriesExceededError: current_app.logger.error( - """Retry: send_inbound_sms_to_service has retried the max number of - times for service: {} and inbound_sms {}""".format( + """Retry: send_inbound_sms_to_service has retried the max number of + times for service: {} and inbound_sms {}""".format( service_id, inbound_sms_id )