Catch socket.errors when sending / recving bytes on wake socketpair (#1069)

This commit is contained in:
Dana Powers 2017-04-05 10:11:21 -07:00 committed by GitHub
parent d40d106c73
commit bb9642f04c
1 changed files with 4 additions and 2 deletions

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