Skip to content

Commit 22df82d

Browse files
ref(celery): Add comment about kwargs_headers
This comment clarifies a potentially confusing part of the code.
1 parent 2440ddb commit 22df82d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

sentry_sdk/integrations/celery/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,11 @@ def sentry_publish(self, *args, **kwargs):
447447
# type: (Producer, *Any, **Any) -> Any
448448
kwargs_headers = kwargs.get("headers", {})
449449
if not isinstance(kwargs_headers, Mapping):
450-
# Ensure kwargs_headers is a Mapping, so we can safely call get()
450+
# Ensure kwargs_headers is a Mapping, so we can safely call get().
451+
# We don't expect this to happen, but it's better to be safe. Even
452+
# if it does happen, only our instrumentation breaks. This line
453+
# does not overwrite kwargs["headers"], so the original publish
454+
# method will still work.
451455
kwargs_headers = {}
452456

453457
task_name = kwargs_headers.get("task")

0 commit comments

Comments
 (0)