summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDana Powers <dana.powers@gmail.com>2016-04-07 08:08:19 -0700
committerDana Powers <dana.powers@gmail.com>2016-04-07 08:28:00 -0700
commit19973cf8848137fe1bd0f8ed4543111f721c65af (patch)
tree778c4ee738b4a66b65f3f37f1f3871cee7667654
parent5ed59a95e7acbadaaa9a633a4d0e61c043a1fed9 (diff)
downloadkafka-python-19973cf8848137fe1bd0f8ed4543111f721c65af.tar.gz
Track last_failure in BrokerConnection.close()
-rw-r--r--kafka/conn.py3
1 files changed, 1 insertions, 2 deletions
diff --git a/kafka/conn.py b/kafka/conn.py
index 44912a5..8e3c657 100644
--- a/kafka/conn.py
+++ b/kafka/conn.py
@@ -109,13 +109,11 @@ class BrokerConnection(object):
log.error('Connect attempt to %s returned error %s.'
' Disconnecting.', self, ret)
self.close()
- self.last_failure = time.time()
# Connection timedout
elif time.time() > request_timeout + self.last_attempt:
log.error('Connection attempt to %s timed out', self)
self.close() # error=TimeoutError ?
- self.last_failure = time.time()
# Needs retry
else:
@@ -154,6 +152,7 @@ class BrokerConnection(object):
self._sock.close()
self._sock = None
self.state = ConnectionStates.DISCONNECTED
+ self.last_failure = time.time()
self._receiving = False
self._next_payload_bytes = 0
self._rbuffer.seek(0)