diff options
author | Alexander Sibiryakov <sibiryakov@users.noreply.github.com> | 2016-11-18 19:45:38 +0100 |
---|---|---|
committer | Dana Powers <dana.powers@gmail.com> | 2016-11-18 10:45:38 -0800 |
commit | af7f2ced1bfe2fc4f50887a05fcaa81afb49b59c (patch) | |
tree | d960ec93723c7920f106edcef57bce656022ad13 | |
parent | 6bd1e1db575612ac7f714fca41e4f679cf2fc758 (diff) | |
download | kafka-python-af7f2ced1bfe2fc4f50887a05fcaa81afb49b59c.tar.gz |
setting proper topic value in case if it's empty (#867)
-rw-r--r-- | kafka/client_async.py | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/kafka/client_async.py b/kafka/client_async.py index bd9bf2e..11251c2 100644 --- a/kafka/client_async.py +++ b/kafka/client_async.py @@ -708,18 +708,11 @@ class KafkaClient(object): self._last_no_node_available_ms = time.time() * 1000 return timeout - topics = list(self._topics) - if self.cluster.need_all_topic_metadata: - if self.config['api_version'] < (0, 10): - topics = [] - else: - topics = None - if self._can_send_request(node_id): - if self.config['api_version'] < (0, 10): - api_version = 0 - else: - api_version = 1 + topics = list(self._topics) + if self.cluster.need_all_topic_metadata or not topics: + topics = [] if self.config['api_version'] < (0, 10) else None + api_version = 0 if self.config['api_version'] < (0, 10) else 1 request = MetadataRequest[api_version](topics) log.debug("Sending metadata request %s to node %s", request, node_id) future = self.send(node_id, request) |