Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix properties default value #281

Merged
merged 2 commits into from Jan 26, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion django_celery_results/backends/database.py
Expand Up @@ -40,7 +40,7 @@ def _store_result(
)

task_name = getattr(request, 'task', None)
properties = getattr(request, 'properties', {})
properties = getattr(request, 'properties') or {}
periodic_task_name = properties.get('periodic_task_name', None)
worker = getattr(request, 'hostname', None)

Expand Down
2 changes: 1 addition & 1 deletion t/unit/backends/test_database.py
Expand Up @@ -45,7 +45,7 @@ def _create_request(self, task_id, name, args, kwargs,
)
if task_protocol == 1:
body, headers, _, _ = hybrid_to_proto2(msg, msg.body)
properties = {}
properties = None
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about None or {}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed this field to reflect the problem and create a more edge-case like scenario when the properties field are present but with None value.

sent_event = {}
else:
headers, properties, body, sent_event = msg
Expand Down