File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
django_declarative_apis/machinery Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change 2626 import cid .locals
2727
2828 _get_correlation_id = cid .locals .get_cid
29+ _set_correlation_id = cid .locals .set_cid
2930except ImportError :
3031 _get_correlation_id = lambda : None # noqa: E731
32+ _set_correlation_id = lambda _ : None # noqa: E731
3133
3234JOB_COUNT_CACHE_KEY = "future_task_runner:job_id"
3335QUEUE_LENGTH_CACHE_KEY = "future_task_runner:current_queue_length"
@@ -151,6 +153,9 @@ def future_task_runner(
151153 resource_instance = resource_class .objects .get (pk = resource_instance_id )
152154 endpoint_task = getattr (endpoint_class , endpoint_method_name )
153155
156+ if correlation_id :
157+ _set_correlation_id (correlation_id )
158+
154159 _log_task_stats (
155160 endpoint_method_name ,
156161 resource_instance_id ,
@@ -291,6 +296,9 @@ def resource_task_runner(
291296 resource_instance = resource_class .objects .get (pk = resource_instance_id )
292297 resource_method = getattr (resource_instance , resource_method_name )
293298
299+ if correlation_id :
300+ _set_correlation_id (correlation_id )
301+
294302 _log_task_stats (
295303 "{0}.{1}" .format (resource_class_name , resource_method_name ),
296304 resource_instance_id ,
You can’t perform that action at this time.
0 commit comments