Skip to content

Commit 660b4de

Browse files
committed
bootstrap node should be last resort in least_loaded_node()
1 parent 0d1ccc7 commit 660b4de

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

kafka/client_async.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,13 @@ def least_loaded_node(self):
440440
"""
441441
nodes = list(self._conns.keys())
442442
random.shuffle(nodes)
443+
444+
# If there's a lingering bootstrap node, always try it last
445+
# really we should just kill this connection
446+
if 'bootstrap' in nodes:
447+
nodes.remove('bootstrap')
448+
nodes.append('bootstrap')
449+
443450
inflight = float('inf')
444451
found = None
445452
for node_id in nodes:

0 commit comments

Comments
 (0)