summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDana Powers <dana.powers@gmail.com>2016-04-25 18:58:40 -0700
committerDana Powers <dana.powers@gmail.com>2016-04-25 21:45:18 -0700
commit959e57fb7d87860c310946602bcd802c8c21bf14 (patch)
tree1ad6414520b9aa69e174e7511cd68b0acceb9e9c
parent0b664ff3755e2e21c7aeb76e3f9020afe16ae74b (diff)
downloadkafka-python-959e57fb7d87860c310946602bcd802c8c21bf14.tar.gz
Disable standard metadata refresh hook during bootstrap
-rw-r--r--kafka/client_async.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/kafka/client_async.py b/kafka/client_async.py
index 6f5d1fe..7fe0272 100644
--- a/kafka/client_async.py
+++ b/kafka/client_async.py
@@ -142,6 +142,7 @@ class KafkaClient(object):
# Exponential backoff if bootstrap fails
backoff_ms = self.config['reconnect_backoff_ms'] * 2 ** self._bootstrap_fails
next_at = self._last_bootstrap + backoff_ms / 1000.0
+ self._refresh_on_disconnects = False
now = time.time()
if next_at > now:
log.debug("Sleeping %0.4f before bootstrapping again", next_at - now)
@@ -180,6 +181,7 @@ class KafkaClient(object):
log.error('Unable to bootstrap from %s', hosts)
# Max exponential backoff is 2^12, x4000 (50ms -> 200s)
self._bootstrap_fails = min(self._bootstrap_fails + 1, 12)
+ self._refresh_on_disconnects = True
def _can_connect(self, node_id):
if node_id not in self._conns: