mirror of
https://github.com/outbackdingo/patroni.git
synced 2026-08-25 14:53:37 +00:00
Add comments to set_ttl method
To explain how it's supposed to work and why it manupulates with the cache of `Cluster` object (calls `reset_cluster`)
This commit is contained in:
@@ -101,7 +101,9 @@ class Consul(AbstractDCS):
|
||||
except Exception:
|
||||
logger.exception("Can not destroy session %s", self._session)
|
||||
self._session = None
|
||||
# force `watch` method to call `AbstractDCS.watch` instead of watching for leader key
|
||||
self.reset_cluster()
|
||||
# fire up an event to wake up from `watch` and immediately run HA loop (to create the new session)
|
||||
self.event.set()
|
||||
self._ttl = ttl
|
||||
|
||||
|
||||
@@ -218,7 +218,9 @@ class Etcd(AbstractDCS):
|
||||
def set_ttl(self, ttl):
|
||||
ttl = int(ttl)
|
||||
if self._ttl != ttl:
|
||||
# force `watch` method to call `AbstractDCS.watch` instead of watching for leader key
|
||||
self.reset_cluster()
|
||||
# fire up an event to wake up from `watch` and immediately run HA loop (to update TTL of leader and member)
|
||||
self.event.set()
|
||||
self._ttl = ttl
|
||||
|
||||
|
||||
Reference in New Issue
Block a user