From e71414cc89492e578830b397fd7f84e330e62f72 Mon Sep 17 00:00:00 2001 From: Himanshu Mishra Date: Sun, 23 Aug 2020 03:26:21 +0530 Subject: [PATCH] Allow configurable timeouts in admin client check version Currently there's no way to pass timeout to check_version if called from admin. --- kafka/admin/client.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kafka/admin/client.py b/kafka/admin/client.py index d0fa84560..5e25407ca 100644 --- a/kafka/admin/client.py +++ b/kafka/admin/client.py @@ -204,7 +204,7 @@ def __init__(self, **configs): self._client = KafkaClient(metrics=self._metrics, metric_group_prefix='admin', **self.config) - self._client.check_version() + self._client.check_version(timeout=(self.config['api_version_auto_timeout_ms'] / 1000)) # Get auto-discovered version from client if necessary if self.config['api_version'] is None: @@ -271,7 +271,7 @@ def _refresh_controller_id(self): response = future.value controller_id = response.controller_id # verify the controller is new enough to support our requests - controller_version = self._client.check_version(controller_id) + controller_version = self._client.check_version(controller_id, timeout=(self.config['api_version_auto_timeout_ms'] / 1000)) if controller_version < (0, 10, 0): raise IncompatibleBrokerVersion( "The controller appears to be running Kafka {}. KafkaAdminClient requires brokers >= 0.10.0.0."