to squelch the __del issue

This commit is contained in:
Chris Lane
2016-04-13 19:54:55 -07:00
parent 0c94b83a2d
commit 92436c0ec0

View File

@@ -133,8 +133,10 @@ class KafkaClient(object):
self._selector.register(self._wake_r, selectors.EVENT_READ)
def __del__(self):
self._wake_r.close()
self._wake_w.close()
if hasattr(self, '_wake_r'):
os.close(self._wake_r)
if hasattr(self, '_wake_w'):
os.close(self._wake_w)
def _bootstrap(self, hosts):
# Exponential backoff if bootstrap fails