diff --git a/features/standby_cluster.feature b/features/standby_cluster.feature index 16faf06e..e76f5152 100644 --- a/features/standby_cluster.feature +++ b/features/standby_cluster.feature @@ -4,6 +4,7 @@ Feature: standby cluster Then postgres1 is a leader after 10 seconds When I issue a PATCH request to http://127.0.0.1:8009/config with {"slots": {"test_logical": {"type": "logical", "database": "postgres", "plugin": "test_decoding"}}} Then I receive a response code 200 + And Response on GET http://127.0.0.1:8009/config contains slots after 10 seconds When I issue a PATCH request to http://127.0.0.1:8009/config with {"slots": {"pm_1": {"type": "physical"}}, "postgresql": {"parameters": {"wal_level": "logical"}}} Then I receive a response code 200 When I start postgres0 with callback configured diff --git a/patroni/dcs/zookeeper.py b/patroni/dcs/zookeeper.py index 315258ae..d7911027 100644 --- a/patroni/dcs/zookeeper.py +++ b/patroni/dcs/zookeeper.py @@ -37,7 +37,9 @@ class PatroniSequentialThreadingHandler(SequentialThreadingHandler): `connect_timeout` (negotiated session timeout) as the second element.""" args = list(args) - if len(args) == 1: + if len(args) == 0: # kazoo 2.6.0 slightly changed the way how it calls create_connection method + kwargs['timeout'] = max(self._connect_timeout, kwargs.get('timeout', self._connect_timeout*10)/10.0) + elif len(args) == 1: args.append(self._connect_timeout) else: args[1] = max(self._connect_timeout, args[1]/10.0) diff --git a/tests/test_zookeeper.py b/tests/test_zookeeper.py index d8de0680..e33047c8 100644 --- a/tests/test_zookeeper.py +++ b/tests/test_zookeeper.py @@ -113,6 +113,7 @@ class TestPatroniSequentialThreadingHandler(unittest.TestCase): def test_create_connection(self): self.assertIsNotNone(self.handler.create_connection(())) self.assertIsNotNone(self.handler.create_connection((), 40)) + self.assertIsNotNone(self.handler.create_connection(timeout=40)) class TestZooKeeper(unittest.TestCase):