Skip to content

Commit

Permalink
Fix for missing periodic task name (#445)
Browse files Browse the repository at this point in the history
* fix for missing periodic task name in rabbitmq

* update tests for periodic_task_name
  • Loading branch information
ntindicator authored Oct 23, 2024
1 parent 416551c commit 0aa8e97
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions django_celery_results/backends/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ def _get_extended_properties(self, request, traceback):
if task_kwargs is not None:
_, _, task_kwargs = self.encode_content(task_kwargs)

properties = getattr(request, 'properties', {}) or {}
periodic_task_name = properties.get('periodic_task_name', None)
periodic_task_name = getattr(request, 'periodic_task_name', None)

extended_props.update({
'periodic_task_name': periodic_task_name,
'task_args': task_args,
Expand Down
8 changes: 4 additions & 4 deletions t/unit/backends/test_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@ def test_on_chord_part_return(self):
request.argsrepr = "argsrepr"
request.kwargsrepr = "kwargsrepr"
request.hostname = "celery@ip-0-0-0-0"
request.properties = {"periodic_task_name": "my_periodic_task"}
request.periodic_task_name = "my_periodic_task"
request.ignore_result = False
result = {"foo": "baz"}

Expand Down Expand Up @@ -839,7 +839,7 @@ def test_callback_failure(self):
request.argsrepr = "argsrepr"
request.kwargsrepr = "kwargsrepr"
request.hostname = "celery@ip-0-0-0-0"
request.properties = {"periodic_task_name": "my_periodic_task"}
request.periodic_task_name = "my_periodic_task"
request.ignore_result = False
request.chord.id = cid
result = {"foo": "baz"}
Expand Down Expand Up @@ -885,7 +885,7 @@ def test_on_chord_part_return_failure(self):
request.argsrepr = "argsrepr"
request.kwargsrepr = "kwargsrepr"
request.hostname = "celery@ip-0-0-0-0"
request.properties = {"periodic_task_name": "my_periodic_task"}
request.periodic_task_name = "my_periodic_task"
request.chord.id = cid
result = {"foo": "baz"}

Expand Down Expand Up @@ -1018,7 +1018,7 @@ def test_on_chord_part_return_multiple_databases(self):
request.argsrepr = "argsrepr"
request.kwargsrepr = "kwargsrepr"
request.hostname = "celery@ip-0-0-0-0"
request.properties = {"periodic_task_name": "my_periodic_task"}
request.periodic_task_name = "my_periodic_task"
request.ignore_result = False
result = {"foo": "baz"}

Expand Down

0 comments on commit 0aa8e97

Please sign in to comment.