Skip to content

Commit

Permalink
ref(celery): Add comment about kwargs_headers
Browse files Browse the repository at this point in the history
This comment clarifies a potentially confusing part of the code.
  • Loading branch information
szokeasaurusrex committed May 17, 2024
1 parent 2440ddb commit 22df82d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion sentry_sdk/integrations/celery/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,11 @@ def sentry_publish(self, *args, **kwargs):
# type: (Producer, *Any, **Any) -> Any
kwargs_headers = kwargs.get("headers", {})
if not isinstance(kwargs_headers, Mapping):
# Ensure kwargs_headers is a Mapping, so we can safely call get()
# Ensure kwargs_headers is a Mapping, so we can safely call get().
# We don't expect this to happen, but it's better to be safe. Even
# if it does happen, only our instrumentation breaks. This line
# does not overwrite kwargs["headers"], so the original publish
# method will still work.
kwargs_headers = {}

task_name = kwargs_headers.get("task")
Expand Down

0 comments on commit 22df82d

Please sign in to comment.