Skip to content

Commit af7f2ce

Browse files
sibiryakovdpkp
authored andcommitted
setting proper topic value in case if it's empty (#867)
1 parent 6bd1e1d commit af7f2ce

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

kafka/client_async.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -708,18 +708,11 @@ def _maybe_refresh_metadata(self):
708708
self._last_no_node_available_ms = time.time() * 1000
709709
return timeout
710710

711-
topics = list(self._topics)
712-
if self.cluster.need_all_topic_metadata:
713-
if self.config['api_version'] < (0, 10):
714-
topics = []
715-
else:
716-
topics = None
717-
718711
if self._can_send_request(node_id):
719-
if self.config['api_version'] < (0, 10):
720-
api_version = 0
721-
else:
722-
api_version = 1
712+
topics = list(self._topics)
713+
if self.cluster.need_all_topic_metadata or not topics:
714+
topics = [] if self.config['api_version'] < (0, 10) else None
715+
api_version = 0 if self.config['api_version'] < (0, 10) else 1
723716
request = MetadataRequest[api_version](topics)
724717
log.debug("Sending metadata request %s to node %s", request, node_id)
725718
future = self.send(node_id, request)

0 commit comments

Comments
 (0)