LOG a warning if the heartbeat can not be validated
If for some reason the heartbeat can not occur instead of failing silently it is better to at least log a message so that operators can investigate the underlying issue. Change-Id: Ide88314c413afa389d6c039478324d6e47f63e82
This commit is contained in:
parent
c5e1c3f96f
commit
e98a937306
|
@ -17,6 +17,7 @@
|
|||
# under the License.
|
||||
|
||||
import collections
|
||||
import logging
|
||||
|
||||
import msgpack
|
||||
import pymemcache.client
|
||||
|
@ -27,6 +28,9 @@ from tooz import coordination
|
|||
from tooz import locking
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Retry(Exception):
|
||||
"""Exception raised if we need to retry."""
|
||||
|
||||
|
@ -68,8 +72,12 @@ class MemcachedLock(locking.Lock):
|
|||
|
||||
def heartbeat(self):
|
||||
"""Keep the lock alive."""
|
||||
self.coord.client.touch(self.name,
|
||||
expire=self.timeout)
|
||||
poked = self.coord.client.touch(self.name,
|
||||
expire=self.timeout,
|
||||
noreply=False)
|
||||
if not poked:
|
||||
LOG.warn("Unable to heartbeat by updating key '%s' with extended"
|
||||
" expiry of %s seconds", self.name, self.timeout)
|
||||
|
||||
def get_owner(self):
|
||||
return self.coord.client.get(self.name)
|
||||
|
|
Loading…
Reference in New Issue