Skip to content

Commit 1789b98

Browse files
committed
Fix bug in implementation
Previously when the transaction errored it would not exit and would leave the transaction open. Now it exits correctly when an exception is seen during the message transaction.
1 parent 2dbec72 commit 1789b98

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

newrelic/hooks/messagebroker_kombu.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,9 @@ def wrap_consumer_recieve_callback(wrapped, instance, args, kwargs):
169169
try:
170170
return_val = wrapped(*args, **kwargs)
171171
except Exception:
172-
if current_transaction():
172+
if created_transaction:
173+
created_transaction.__exit__(*sys.exc_info())
174+
elif current_transaction():
173175
# Report error on existing transaction if there is one
174176
notice_error()
175177
else:

0 commit comments

Comments
 (0)