From dc45935ec8afe3bd279048351bd21c9dd9d82fdf Mon Sep 17 00:00:00 2001 From: Dana Powers Date: Thu, 17 Nov 2016 20:24:14 -0800 Subject: Also/continue to check for timeouts in BrokerConnection.recv() --- kafka/conn.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'kafka/conn.py') diff --git a/kafka/conn.py b/kafka/conn.py index 0d90cc0..14f4d6d 100644 --- a/kafka/conn.py +++ b/kafka/conn.py @@ -575,7 +575,15 @@ class BrokerConnection(object): log.warning('%s: No in-flight-requests to recv', self) return None - return self._recv() + response = self._recv() + if not response and self.requests_timed_out(): + log.warning('%s timed out after %s ms. Closing connection.', + self, self.config['request_timeout_ms']) + self.close(error=Errors.RequestTimedOutError( + 'Request timed out after %s ms' % + self.config['request_timeout_ms'])) + return None + return response def _recv(self): # Not receiving is the state of reading the payload header -- cgit v1.2.1