Merge pull request #141 from stephenarmstrong/fully-handle-broker-lists

If a broker refuses the connection, try the next
This commit is contained in:
Omar
2014-03-13 18:18:58 -07:00

View File

@@ -83,14 +83,14 @@ class KafkaClient(object):
brokers. Keep trying until you succeed.
"""
for (host, port) in self.hosts:
conn = self._get_conn(host, port)
try:
conn = self._get_conn(host, port)
conn.send(requestId, request)
response = conn.recv(requestId)
return response
except Exception, e:
log.warning("Could not send request [%r] to server %s, "
"trying next server: %s" % (request, conn, e))
log.warning("Could not send request [%r] to server %s:%i, "
"trying next server: %s" % (request, host, port, e))
continue
raise KafkaUnavailableError("All servers failed to process request")