Catch socket.errors when sending / recving bytes on wake socketpair

This commit is contained in:
Dana Powers
2017-04-04 22:00:37 -07:00
parent d40d106c73
commit a4d4a7412e

View File

@@ -829,7 +829,9 @@ class KafkaClient(object):
def wakeup(self):
with self._wake_lock:
if self._wake_w.send(b'x') != 1:
try:
assert self._wake_w.send(b'x') == 1
except (AssertionError, socket.error):
log.warning('Unable to send to wakeup socket!')
def _clear_wake_fd(self):
@@ -837,7 +839,7 @@ class KafkaClient(object):
while True:
try:
self._wake_r.recv(1024)
except:
except socket.error:
break