setting proper topic value in case if it's empty (#867)

This commit is contained in:
Alexander Sibiryakov
2016-11-18 19:45:38 +01:00
committed by Dana Powers
parent 6bd1e1db57
commit af7f2ced1b

View File

@@ -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)