summaryrefslogtreecommitdiff
path: root/kafka/client_async.py
diff options
context:
space:
mode:
authorDana Powers <dana.powers@gmail.com>2016-11-18 09:07:53 -0800
committerGitHub <noreply@github.com>2016-11-18 09:07:53 -0800
commitf71cfc4607c0295a8e131576f8619c9f8ff8f66f (patch)
tree590ccc083b914127d1dbc59c439c07e2f94c76bf /kafka/client_async.py
parent57ea7e81dc00065825c1586af7fe3cc9609d1f6b (diff)
downloadkafka-python-f71cfc4607c0295a8e131576f8619c9f8ff8f66f.tar.gz
Always check for request timeouts (#887)
* Check for requests that timeout without causing a socket read/write event
Diffstat (limited to 'kafka/client_async.py')
-rw-r--r--kafka/client_async.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/kafka/client_async.py b/kafka/client_async.py
index 03a2f00..bd9bf2e 100644
--- a/kafka/client_async.py
+++ b/kafka/client_async.py
@@ -578,6 +578,14 @@ class KafkaClient(object):
if response:
responses.append(response)
+ for conn in six.itervalues(self._conns):
+ if conn.requests_timed_out():
+ log.warning('%s timed out after %s ms. Closing connection.',
+ conn, conn.config['request_timeout_ms'])
+ conn.close(error=Errors.RequestTimedOutError(
+ 'Request timed out after %s ms' %
+ conn.config['request_timeout_ms']))
+
if self._sensors:
self._sensors.io_time.record((time.time() - end_select) * 1000000000)
return responses