Skip to content

Commit 32edabd

Browse files
committed
Merge pull request dpkp#141 from stephenarmstrong/fully-handle-broker-lists
If a broker refuses the connection, try the next
2 parents 09c053a + c4cbe04 commit 32edabd

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

kafka/client.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,14 @@ def _send_broker_unaware_request(self, requestId, request):
8383
brokers. Keep trying until you succeed.
8484
"""
8585
for (host, port) in self.hosts:
86-
conn = self._get_conn(host, port)
8786
try:
87+
conn = self._get_conn(host, port)
8888
conn.send(requestId, request)
8989
response = conn.recv(requestId)
9090
return response
9191
except Exception, e:
92-
log.warning("Could not send request [%r] to server %s, "
93-
"trying next server: %s" % (request, conn, e))
92+
log.warning("Could not send request [%r] to server %s:%i, "
93+
"trying next server: %s" % (request, host, port, e))
9494
continue
9595

9696
raise KafkaUnavailableError("All servers failed to process request")

0 commit comments

Comments
 (0)