summaryrefslogtreecommitdiff
path: root/kafka/coordinator
diff options
context:
space:
mode:
authorDana Powers <dana.powers@gmail.com>2016-03-13 23:49:55 -0700
committerDana Powers <dana.powers@gmail.com>2016-03-13 23:49:55 -0700
commit8303780259375374b6be6c4b1813d077f5a99d7a (patch)
treed615eaaed94f6460a146986e5e62001585a2dd26 /kafka/coordinator
parent0330036bef996815c5ef384ab6803697816e4189 (diff)
downloadkafka-python-8303780259375374b6be6c4b1813d077f5a99d7a.tar.gz
Check for None returned from least_loaded_node when no brokers are availablenone_least_loaded_node
Diffstat (limited to 'kafka/coordinator')
-rw-r--r--kafka/coordinator/consumer.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/kafka/coordinator/consumer.py b/kafka/coordinator/consumer.py
index 0e610c7..a5e3067 100644
--- a/kafka/coordinator/consumer.py
+++ b/kafka/coordinator/consumer.py
@@ -414,6 +414,8 @@ class ConsumerCoordinator(BaseCoordinator):
node_id = self.coordinator_id
else:
node_id = self._client.least_loaded_node()
+ if node_id is None:
+ return Future().failure(Errors.NoBrokersAvailable)
# create the offset commit request
offset_data = collections.defaultdict(dict)
@@ -560,6 +562,8 @@ class ConsumerCoordinator(BaseCoordinator):
node_id = self.coordinator_id
else:
node_id = self._client.least_loaded_node()
+ if node_id is None:
+ return Future().failure(Errors.NoBrokersAvailable)
# Verify node is ready
if not self._client.ready(node_id):