summaryrefslogtreecommitdiff
path: root/kafka
diff options
context:
space:
mode:
authorDana Powers <dana.powers@gmail.com>2017-04-04 22:00:37 -0700
committerDana Powers <dana.powers@gmail.com>2017-04-04 22:00:37 -0700
commita4d4a7412ee9aad0197306b43af957200442820c (patch)
tree6d21f0a116c50e878a374209c1894ee1f1447e82 /kafka
parentd40d106c7327a842ab393fb86d1be0048b0a83ba (diff)
downloadkafka-python-wake_socketpair_exceptions.tar.gz
Catch socket.errors when sending / recving bytes on wake socketpairwake_socketpair_exceptions
Diffstat (limited to 'kafka')
-rw-r--r--kafka/client_async.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/kafka/client_async.py b/kafka/client_async.py
index cf62a8a..fbeb775 100644
--- a/kafka/client_async.py
+++ b/kafka/client_async.py
@@ -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