From feea0df29d393c005439890ea1c606612637abe2 Mon Sep 17 00:00:00 2001 From: Dana Powers Date: Wed, 7 Mar 2018 15:34:36 -0800 Subject: Update SimpleClient w/ connnect_blocking() --- kafka/client.py | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/kafka/client.py b/kafka/client.py index 369dc97..10b1724 100644 --- a/kafka/client.py +++ b/kafka/client.py @@ -71,17 +71,7 @@ class SimpleClient(object): ) conn = self._conns[host_key] - conn.connect() - if conn.connected(): - return conn - - timeout = time.time() + self.timeout - while time.time() < timeout and conn.connecting(): - if conn.connect() is ConnectionStates.CONNECTED: - break - else: - time.sleep(0.05) - else: + if not conn.connect_blocking(self.timeout): conn.close() raise ConnectionError("%s:%s (%s)" % (host, port, afi)) return conn -- cgit v1.2.1