From 0014f4247837e9f082f39b5982600374f2230f86 Mon Sep 17 00:00:00 2001 From: Jacopo Farina Date: Tue, 12 May 2020 11:46:31 +0200 Subject: [PATCH] Check client version iif not given The docstring states the `api_version` and `api_version_auto_timeout_ms` are used to decide if check_version() has to be called and for how long it has to wait, now the function follows that behavior, consistent with the `KafkaClient` --- kafka/admin/client.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/kafka/admin/client.py b/kafka/admin/client.py index d0fa84560..875671ac5 100644 --- a/kafka/admin/client.py +++ b/kafka/admin/client.py @@ -204,11 +204,16 @@ def __init__(self, **configs): self._client = KafkaClient(metrics=self._metrics, metric_group_prefix='admin', **self.config) - self._client.check_version() # Get auto-discovered version from client if necessary if self.config['api_version'] is None: self.config['api_version'] = self._client.config['api_version'] + if self.config['api_version_auto_timeout_ms'] is None: + self._client.check_version() + else: + # check_version timeout is is seconds + self._client.check_version( + self.config['api_version_auto_timeout_ms'] / 1000) self._closed = False self._refresh_controller_id()