Files
patroni/patroni/raft_controller.py
T
Alexander KukushkinandGitHub 99626a07f2 Fix issues with raft traffic encryption (#1919)
and run raft behave tests with encryption enabled.

Using the new `pysyncobj` release allowed us to get rid of a lot of hacks with accessing private properties and methods of the parent class and reduce the size of the `raft.py`.

Close https://github.com/zalando/patroni/issues/1746
2021-04-30 11:28:41 +02:00

30 lines
686 B
Python

import logging
from .daemon import AbstractPatroniDaemon, abstract_main
from .dcs.raft import KVStoreTTL
logger = logging.getLogger(__name__)
class RaftController(AbstractPatroniDaemon):
def __init__(self, config):
super(RaftController, self).__init__(config)
config = self.config.get('raft')
assert 'self_addr' in config
self._raft = KVStoreTTL(None, None, None, **config)
def _run_cycle(self):
try:
self._raft.doTick(self._raft.conf.autoTickPeriod)
except Exception:
logger.exception('doTick')
def _shutdown(self):
self._raft.destroy()
def main():
abstract_main(RaftController)