summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Bouchare <david.bouchare@datadoghq.com>2019-10-04 10:12:09 +0200
committerStephen SORRIAUX <stephen.sorriaux@gmail.com>2019-10-04 10:12:09 +0200
commit961b2f3be557f8314ab41f75444125222638f9cc (patch)
tree43d607c14545bb2b7ec0df6144ef82027c6b5183
parentded79467a8254e43841dfeb69f7c3baa1980232c (diff)
downloadkazoo-961b2f3be557f8314ab41f75444125222638f9cc.tar.gz
feat(core): closed states instead of lost states (#573)
In order to be better in sync with the official documentation (https://zookeeper.apache.org/doc/r3.5.5/zookeeperProgrammers.html#ch_zkSessions) it is better to rename those variables to `close` instead of `lost`.
-rw-r--r--kazoo/client.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/kazoo/client.py b/kazoo/client.py
index 2258c02..f4c21fa 100644
--- a/kazoo/client.py
+++ b/kazoo/client.py
@@ -68,7 +68,7 @@ from kazoo.recipe.watchers import ChildrenWatch, DataWatch
string_types = six.string_types
bytes_types = (six.binary_type,)
-LOST_STATES = (KeeperState.EXPIRED_SESSION, KeeperState.AUTH_FAILED,
+CLOSED_STATES = (KeeperState.EXPIRED_SESSION, KeeperState.AUTH_FAILED,
KeeperState.CLOSED)
ENVI_VERSION = re.compile(r'([\d\.]*).*', re.DOTALL)
ENVI_VERSION_KEY = 'zookeeper.version'
@@ -513,14 +513,14 @@ class KazooClient(object):
# Note that we don't check self.state == LOST since that's also
# the client's initial state
- dead_state = self._state in LOST_STATES
+ closed_state = self._state in CLOSED_STATES
self._state = state
# If we were previously closed or had an expired session, and
# are now connecting, don't bother with the rest of the
# transitions since they only apply after
# we've established a connection
- if dead_state and state == KeeperState.CONNECTING:
+ if closed_state and state == KeeperState.CONNECTING:
self.logger.log(BLATHER, "Skipping state change")
return
@@ -529,8 +529,8 @@ class KazooClient(object):
"state: %s", state)
self._live.set()
self._make_state_change(KazooState.CONNECTED)
- elif state in LOST_STATES:
- self.logger.info("Zookeeper session lost, state: %s", state)
+ elif state in CLOSED_STATES:
+ self.logger.info("Zookeeper session closed, state: %s", state)
self._live.clear()
self._make_state_change(KazooState.LOST)
self._notify_pending(state)