Skip to content

Commit e4c8213

Browse files
committed
try / except in consumer coordinator __del__
1 parent e7b3dbd commit e4c8213

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

kafka/coordinator/consumer.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,10 @@ def __init__(self, client, subscription, metrics, **configs):
128128

129129
def __del__(self):
130130
if hasattr(self, '_cluster') and self._cluster:
131-
self._cluster.remove_listener(WeakMethod(self._handle_metadata_update))
131+
try:
132+
self._cluster.remove_listener(WeakMethod(self._handle_metadata_update))
133+
except TypeError:
134+
pass
132135
super(ConsumerCoordinator, self).__del__()
133136

134137
def protocol_type(self):

0 commit comments

Comments
 (0)