diff options
| author | Dana Powers <dana.powers@rd.io> | 2018-03-07 15:34:36 -0800 |
|---|---|---|
| committer | Dana Powers <dana.powers@rd.io> | 2018-03-09 13:21:15 -0500 |
| commit | feea0df29d393c005439890ea1c606612637abe2 (patch) | |
| tree | b6035ea34bdfc8da27377d223a6bc585742a5f8a /kafka | |
| parent | 41c7afea5d0c2ac2ec43ccdc2cdef4cdeb99f164 (diff) | |
| download | kafka-python-feea0df29d393c005439890ea1c606612637abe2.tar.gz | |
Update SimpleClient w/ connnect_blocking()
Diffstat (limited to 'kafka')
| -rw-r--r-- | kafka/client.py | 12 |
1 files changed, 1 insertions, 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 |
