mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-05 02:41:14 -05:00
Merge pull request #3032 from alphagov/4xx-callbacks
Log when we don't retry a callback
This commit is contained in:
@@ -85,7 +85,7 @@ def _send_data_to_service_callback_api(self, data, service_callback_url, token,
|
|||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
except RequestException as e:
|
except RequestException as e:
|
||||||
current_app.logger.warning(
|
current_app.logger.warning(
|
||||||
"{} request failed for notification_id: {} and url: {}. exc: {}".format(
|
"{} request failed for notification_id: {} and url: {}. exception: {}".format(
|
||||||
function_name,
|
function_name,
|
||||||
notification_id,
|
notification_id,
|
||||||
service_callback_url,
|
service_callback_url,
|
||||||
@@ -103,6 +103,15 @@ def _send_data_to_service_callback_api(self, data, service_callback_url, token,
|
|||||||
notification_id
|
notification_id
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
else:
|
||||||
|
current_app.logger.warning(
|
||||||
|
"{} callback is not being retried for notification_id: {} and url: {}. exception: {}".format(
|
||||||
|
function_name,
|
||||||
|
notification_id,
|
||||||
|
service_callback_url,
|
||||||
|
e
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def create_delivery_status_callback_data(notification, service_callback_api):
|
def create_delivery_status_callback_data(notification, service_callback_api):
|
||||||
|
|||||||
@@ -589,20 +589,15 @@ def send_inbound_sms_to_service(self, inbound_sms_id, service_id):
|
|||||||
},
|
},
|
||||||
timeout=60
|
timeout=60
|
||||||
)
|
)
|
||||||
current_app.logger.debug('send_inbound_sms_to_service sending {} to {}, response {}'.format(
|
current_app.logger.debug(
|
||||||
inbound_sms_id,
|
f"send_inbound_sms_to_service sending {inbound_sms_id} to {inbound_api.url}, " +
|
||||||
inbound_api.url,
|
f"response {response.status_code}"
|
||||||
response.status_code
|
)
|
||||||
))
|
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
except RequestException as e:
|
except RequestException as e:
|
||||||
current_app.logger.warning(
|
current_app.logger.warning(
|
||||||
"send_inbound_sms_to_service failed for service_id: {} for inbound_sms_id: {} and url: {}. exc: {}".format(
|
f"send_inbound_sms_to_service failed for service_id: {service_id} for inbound_sms_id: {inbound_sms_id} " +
|
||||||
service_id,
|
f"and url: {inbound_api.url}. exception: {e}"
|
||||||
inbound_sms_id,
|
|
||||||
inbound_api.url,
|
|
||||||
e
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
if not isinstance(e, HTTPError) or e.response.status_code >= 500:
|
if not isinstance(e, HTTPError) or e.response.status_code >= 500:
|
||||||
try:
|
try:
|
||||||
@@ -612,6 +607,11 @@ def send_inbound_sms_to_service(self, inbound_sms_id, service_id):
|
|||||||
f"Retry: send_inbound_sms_to_service has retried the max number of" +
|
f"Retry: send_inbound_sms_to_service has retried the max number of" +
|
||||||
f"times for service: {service_id} and inbound_sms {inbound_sms_id}"
|
f"times for service: {service_id} and inbound_sms {inbound_sms_id}"
|
||||||
)
|
)
|
||||||
|
else:
|
||||||
|
current_app.logger.warning(
|
||||||
|
f"send_inbound_sms_to_service is not being retried for service_id: {service_id} for " +
|
||||||
|
f"inbound_sms id: {inbound_sms_id} and url: {inbound_api.url}. exception: {e}"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@notify_celery.task(name='process-incomplete-jobs')
|
@notify_celery.task(name='process-incomplete-jobs')
|
||||||
|
|||||||
Reference in New Issue
Block a user