Skip to content

Commit 696d9d4

Browse files
committed
[celery#305]: extend_task_props_callback relocated.
`extend_task_props_callback` moved from `_get_extended_properties` to `_store_result`. Suggested by @AllesVeldman. `extend_task_props_callback` will get the `request` object as first parameter and a copy of `task_props` (avoiding potential manipulation of the original `task_props`) as second paramenter. --- Resolves celery#305 Fixes celery#314
1 parent 16be793 commit 696d9d4

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

django_celery_results/backends/database.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,6 @@ def _get_extended_properties(self, request, traceback):
7979
# task protocol 1
8080
task_kwargs = getattr(request, 'kwargs', None)
8181

82-
# TODO: We assuming that task protocol 1 could be always in use. :/
83-
extended_props.update(
84-
extend_task_props_callback(getattr(request, 'kwargs', None)))
85-
8682
# Encode input arguments
8783
if task_args is not None:
8884
_, _, task_args = self.encode_content(task_args)
@@ -133,6 +129,9 @@ def _store_result(
133129
self._get_extended_properties(request, traceback)
134130
)
135131

132+
task_props.update(
133+
extend_task_props_callback(request, dict(task_props)))
134+
136135
self.TaskModel._default_manager.store_result(**task_props)
137136
return result
138137

0 commit comments

Comments
 (0)