diff options
author | Dana Powers <dana.powers@gmail.com> | 2019-09-28 15:58:17 -0700 |
---|---|---|
committer | Dana Powers <dana.powers@gmail.com> | 2019-09-28 15:58:17 -0700 |
commit | 2e6a43839bde28c3eaeeb010bcdfb936ae54730f (patch) | |
tree | ce7248ca21b3e167b022e1d70e76a21066a0a87e /kafka/conn.py | |
parent | 61fa0b27685c2d4e67d1b6575ca6797f36eb1bfa (diff) | |
download | kafka-python-connection_delay_inf.tar.gz |
Rely on selector to detect completed connection attemptsconnection_delay_inf
Diffstat (limited to 'kafka/conn.py')
-rw-r--r-- | kafka/conn.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/kafka/conn.py b/kafka/conn.py index 5ef141c..07b667a 100644 --- a/kafka/conn.py +++ b/kafka/conn.py @@ -748,16 +748,16 @@ class BrokerConnection(object): """ Return the number of milliseconds to wait, based on the connection state, before attempting to send data. When disconnected, this respects - the reconnect backoff time. When connecting, returns 0 to allow - non-blocking connect to finish. When connected, returns a very large - number to handle slow/stalled connections. + the reconnect backoff time. When connecting or connected, returns a very + large number to handle slow/stalled connections. """ time_waited = time.time() - (self.last_attempt or 0) if self.state is ConnectionStates.DISCONNECTED: return max(self._reconnect_backoff - time_waited, 0) * 1000 - elif self.connecting(): - return 0 else: + # When connecting or connected, we should be able to delay + # indefinitely since other events (connection or data acked) will + # cause a wakeup once data can be sent. return float('inf') def connected(self): |