Files
notifications-api/app/celery/celery.py
Katie Smith ceb7cee009 Pass request_id to tasks if available
We want to pass the `request_id` to Celery tasks if the task is called
from an HTTP request, so that we can add the `request_id` to the logs.
This change overwrites `apply_async` to add the `request_id` to the
kwargs if available. When we call the task, we then add the `request_id`
to g on Flask's application context.

Tasks called from `send_task` won't have a `request_id` for now, and
this change only affects tasks called from HTTP requests (not from other
tasks or from Celery Beat).
2019-10-28 10:59:25 +00:00

2.2 KiB