Skip to content

Commit

Permalink
avoid exception when property name changes
Browse files Browse the repository at this point in the history
  • Loading branch information
nozik committed Dec 20, 2021
1 parent fdba606 commit 68f9783
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ def _instrument_blocking_channel_consumers(
) -> Any:
for consumer_tag, consumer_info in channel._consumer_infos.items():
callback_attr = PikaInstrumentor.CONSUMER_CALLBACK_ATTR
consumer_callback = getattr(consumer_info, callback_attr)
consumer_callback = getattr(consumer_info, callback_attr, None)
if consumer_callback is None:
continue
decorated_callback = utils._decorate_callback(
consumer_callback,
tracer,
Expand Down Expand Up @@ -142,7 +144,7 @@ def uninstrument_channel(channel: BlockingChannel) -> None:

for consumers_tag, client_info in channel._consumer_infos.items():
callback_attr = PikaInstrumentor.CONSUMER_CALLBACK_ATTR
consumer_callback = getattr(client_info, callback_attr)
consumer_callback = getattr(client_info, callback_attr, None)
if hasattr(consumer_callback, "_original_callback"):
channel._consumer_infos[
consumers_tag
Expand Down

0 comments on commit 68f9783

Please sign in to comment.