Skip to content

Commit 4172daa

Browse files
committed
fix(celery): Close the connection we're reading driver_type from
1 parent 3373da2 commit 4172daa

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

sentry_sdk/integrations/celery/__init__.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -392,10 +392,11 @@ def _inner(*args: "Any", **kwargs: "Any") -> "Any":
392392
)
393393

394394
with capture_internal_exceptions():
395-
span.set_data(
396-
SPANDATA.MESSAGING_SYSTEM,
397-
task.app.connection().transport.driver_type,
398-
)
395+
with task.app.connection() as conn:
396+
span.set_data(
397+
SPANDATA.MESSAGING_SYSTEM,
398+
conn.transport.driver_type,
399+
)
399400

400401
return f(*args, **kwargs)
401402
except Exception:

0 commit comments

Comments
 (0)