Log exceptions in cache listener events

Change-Id: Ife566e09c23b644d8d777c0f59f1effb6be3ec6c
This commit is contained in:
James E. Blair 2018-11-30 13:28:25 -08:00
parent c2d410d9fe
commit a0e4ff87f7
1 changed files with 13 additions and 0 deletions

View File

@ -2086,7 +2086,13 @@ class ZooKeeper(object):
self.log.exception(e)
def nodeCacheListener(self, event):
try:
self._nodeCacheListener(event)
except Exception:
self.log.exception("Exception in node cache update for event: %s",
event)
def _nodeCacheListener(self, event):
if hasattr(event.event_data, 'path'):
# Ignore root node
path = event.event_data.path
@ -2142,7 +2148,14 @@ class ZooKeeper(object):
self.node_stats_event = event
def requestCacheListener(self, event):
try:
self._requestCacheListener(event)
except Exception:
self.log.exception(
"Exception in request cache update for event: %s",
event)
def _requestCacheListener(self, event):
if hasattr(event.event_data, 'path'):
# Ignore root node
path = event.event_data.path