diff options
author | Dana Powers <dana.powers@gmail.com> | 2016-03-14 08:23:41 -0700 |
---|---|---|
committer | Dana Powers <dana.powers@gmail.com> | 2016-03-14 08:23:41 -0700 |
commit | ba06e68bedb3d1771d116dffe719a4e1e0a51c77 (patch) | |
tree | 63e6acfb0bd125cd1f5a7d987b5d5d982c134c4a /kafka/client_async.py | |
parent | 6e68ccd716775a05f7382fbefd8a39a6b748590a (diff) | |
parent | 8303780259375374b6be6c4b1813d077f5a99d7a (diff) | |
download | kafka-python-ba06e68bedb3d1771d116dffe719a4e1e0a51c77.tar.gz |
Merge pull request #588 from dpkp/none_least_loaded_node
Improve handling of least_loaded_node failure
Diffstat (limited to 'kafka/client_async.py')
-rw-r--r-- | kafka/client_async.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/kafka/client_async.py b/kafka/client_async.py index 973ece0..57aea66 100644 --- a/kafka/client_async.py +++ b/kafka/client_async.py @@ -532,6 +532,8 @@ class KafkaClient(object): return 9999999999 node_id = self.least_loaded_node() + if node_id is None: + return 0 topics = list(self._topics) if self.cluster.need_all_topic_metadata: @@ -588,6 +590,8 @@ class KafkaClient(object): """Attempt to guess the broker version""" if node_id is None: node_id = self.least_loaded_node() + if node_id is None: + raise Errors.NoBrokersAvailable() def connect(node_id): timeout_at = time.time() + timeout |