Skip to content

Commit 2ae392e

Browse files
raltStephenSorriaux
authored andcommitted
fix(core): reduce timeout for the first Connect() request (#540)
In the case of a zookeeper server under pressure, it will typically try to maintain the quorum rather than handling client requests. In this kind of case, the quorum is maintained, the connection works, but the client is frozen there. Retrying after a shorter timeout means we can reconnect to another server before losing the session altogether.
1 parent c48f273 commit 2ae392e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kazoo/protocol/connection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,7 @@ def _connect(self, host, port):
660660
client.read_only)
661661

662662
connect_result, zxid = self._invoke(
663-
client._session_timeout / 1000.0, connect)
663+
client._session_timeout / 1000.0 / len(client.hosts), connect)
664664

665665
if connect_result.time_out <= 0:
666666
raise SessionExpiredError("Session has expired")

0 commit comments

Comments
 (0)