summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDana Powers <dana.powers@gmail.com>2016-02-15 21:06:06 -0800
committerDana Powers <dana.powers@gmail.com>2016-02-15 21:56:31 -0800
commit660b4de23204f51fbfd16421f7d02404f386bb83 (patch)
tree42cc03134b5504e3865ce667cf6a79f671f6adfa
parent0d1ccc7485acf09b282d8cc7a06cfd94e690eddb (diff)
downloadkafka-python-660b4de23204f51fbfd16421f7d02404f386bb83.tar.gz
bootstrap node should be last resort in least_loaded_node()
-rw-r--r--kafka/client_async.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/kafka/client_async.py b/kafka/client_async.py
index 0f4863a..f048be9 100644
--- a/kafka/client_async.py
+++ b/kafka/client_async.py
@@ -440,6 +440,13 @@ class KafkaClient(object):
"""
nodes = list(self._conns.keys())
random.shuffle(nodes)
+
+ # If there's a lingering bootstrap node, always try it last
+ # really we should just kill this connection
+ if 'bootstrap' in nodes:
+ nodes.remove('bootstrap')
+ nodes.append('bootstrap')
+
inflight = float('inf')
found = None
for node_id in nodes: