Compute requires_beating

Computers are smarter than humans. Proof is that we forgot to set
requires_beating to the etcd driver, whereas it does require it. Doh!
Same goes for Zookeeper actually.

Use the computer power to find out if a driver requires beating… or not.

Change-Id: I4ef5841a06fe361f87c3ba336d3688c3684bffd7
This commit is contained in:
Julien Danjou 2016-02-12 17:22:12 +01:00
parent 3687a581ad
commit ea570c6964
3 changed files with 3 additions and 6 deletions

View File

@ -154,6 +154,9 @@ class CoordinationDriver(object):
self._hooks_elected_leader = collections.defaultdict(Hooks)
# A cache for group members
self._group_members = collections.defaultdict(set)
self.requires_beating = (
CoordinationDriver.heartbeat != self.__class__.heartbeat
)
def _has_hooks_for_group(self, group_id):
return (len(self._hooks_join_group[group_id]) +

View File

@ -215,9 +215,6 @@ class MemcachedDriver(coordination._RunWatchersMixin,
#: String used to keep a key/member alive (until it next expires).
STILL_ALIVE = b"It's alive!"
#: This driver requires constant periodic (heart) beatings.
requires_beating = True
def __init__(self, member_id, parsed_url, options):
super(MemcachedDriver, self).__init__()
options = utils.collapse(options)

View File

@ -314,9 +314,6 @@ return 1
.. _Lua: http://www.lua.org
"""
#: This driver requires constant periodic (heart) beatings.
requires_beating = True
def __init__(self, member_id, parsed_url, options):
super(RedisDriver, self).__init__()
options = utils.collapse(options, exclude=self.CLIENT_LIST_ARGS)