summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Margaine <ralt@users.noreply.github.com>2018-11-27 12:00:49 +0100
committerStephen SORRIAUX <stephen.sorriaux@gmail.com>2018-11-27 11:00:49 +0000
commit2ae392e69c4b2daca5d8e7f0e79b7ce90423e65c (patch)
tree53ab4a39e91fd9b688a67c785da1ddc00d664d0a
parentc48f2733f2a6b2c2941738e4208e8cfede676730 (diff)
downloadkazoo-2ae392e69c4b2daca5d8e7f0e79b7ce90423e65c.tar.gz
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.
-rw-r--r--kazoo/protocol/connection.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/kazoo/protocol/connection.py b/kazoo/protocol/connection.py
index 27388e1..67d5789 100644
--- a/kazoo/protocol/connection.py
+++ b/kazoo/protocol/connection.py
@@ -660,7 +660,7 @@ class ConnectionHandler(object):
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")