Skip to content

Commit

Permalink
Rework callback logging (#2078)
Browse files Browse the repository at this point in the history
* Decoupled scan malware code + lowering retry period for high priority emails

* Extract common email retry handling logic into its own function

* Cleaned up import

* Forgot to provide default value to optional fn arg

* Fixed test import

* Isolated retry task param builder in a class

* Cleaned up import

* Fixed moved refs

* Trying a different strategy to fix circular import

* Fixing another bad import ref

* Introducing celery utils module instead of using celery root one

* Cover edge cases + modified tests

* Formatting

* Sort imports

* Make notification_process_type param optional

* Fixed edge case when template not associated with notification obj

* Fixing params order

* Fixing regression tests

* More tests

* Added null protection against a potential NPE

* Formatting

* Fix imports

* Moved logging for callback prior to actual call

* Format service_callback_tasks.py
  • Loading branch information
jimleroyer authored May 23, 2024
1 parent 6919e3c commit dccea53
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/celery/service_callback_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ def send_complaint_to_service(self, complaint_data):
def _send_data_to_service_callback_api(self, data, service_callback_url, token, function_name):
notification_id = data["notification_id"] if "notification_id" in data else data["id"]
try:
current_app.logger.info("{} sending {} to {}".format(function_name, notification_id, service_callback_url))
response = request(
method="POST",
url=service_callback_url,
Expand All @@ -69,9 +70,11 @@ def _send_data_to_service_callback_api(self, data, service_callback_url, token,
},
timeout=5,
)

current_app.logger.info(
f"{function_name} sending {notification_id} to {service_callback_url}, response {response.status_code}"
)

response.raise_for_status()
except RequestException as e:
current_app.logger.warning(
Expand Down

0 comments on commit dccea53

Please sign in to comment.