From 0a8dabdf22e14396d3edcfeab4791065840bcc8c Mon Sep 17 00:00:00 2001 From: Dana Powers Date: Sat, 17 Dec 2016 10:39:06 -0800 Subject: Use connection state functions where possible --- kafka/client_async.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'kafka/client_async.py') diff --git a/kafka/client_async.py b/kafka/client_async.py index 6179eba..2c6413a 100644 --- a/kafka/client_async.py +++ b/kafka/client_async.py @@ -229,7 +229,7 @@ class KafkaClient(object): bootstrap.connect() while bootstrap.connecting(): bootstrap.connect() - if bootstrap.state is not ConnectionStates.CONNECTED: + if not bootstrap.connected(): bootstrap.close() continue future = bootstrap.send(metadata_request) @@ -261,7 +261,7 @@ class KafkaClient(object): return True return False conn = self._conns[node_id] - return conn.state is ConnectionStates.DISCONNECTED and not conn.blacked_out() + return conn.disconnected() and not conn.blacked_out() def _conn_state_change(self, node_id, conn): if conn.connecting(): @@ -398,7 +398,7 @@ class KafkaClient(object): conn = self._conns[node_id] time_waited_ms = time.time() - (conn.last_attempt or 0) - if conn.state is ConnectionStates.DISCONNECTED: + if conn.disconnected(): return max(self.config['reconnect_backoff_ms'] - time_waited_ms, 0) elif conn.connecting(): return 0 -- cgit v1.2.1