Skip to content

Commit

Permalink
fix(core): reduce timeout for the first Connect() request (#540)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ralt authored and StephenSorriaux committed Nov 27, 2018
1 parent c48f273 commit 2ae392e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kazoo/protocol/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ def _connect(self, host, port):
client.read_only)

connect_result, zxid = self._invoke(
client._session_timeout / 1000.0, connect)
client._session_timeout / 1000.0 / len(client.hosts), connect)

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

0 comments on commit 2ae392e

Please sign in to comment.