Fix exception in cache update
In the ZK cache, we previously would exit the cache update method if we received a cache add or update with the empty string as data. This usually represents a component trying to lock something after it has been deleted, and the path being recreated with empty data, so it's safe to ignore. During the recent cache refactor, the short circuit we previously had (if !data, return) was inadvertently converted to (if !data, data=None) which would then throw an exception as we tried to deserialize a None object. The only reason to proceed with the method at this point is to trigger the postCacheHook, and the only postCacheHook implemented updates node stats, which don't need to be updated in this case. In other words, the old behavior of simply returning from the cache listener in this case is acceptable and we should revert to it. Change-Id: I9567bd387ab65f08a3f05be466760bd8e1c5c149
This commit is contained in:
parent
c56cab313a
commit
7d83166346
|
@ -768,10 +768,9 @@ class NodepoolTreeCache(abc.ABC):
|
|||
|
||||
if event.event_type in (TreeEvent.NODE_ADDED, TreeEvent.NODE_UPDATED):
|
||||
# Images with empty data are invalid so skip add or update these.
|
||||
if event.event_data.data:
|
||||
data = self.zk._bytesToDict(event.event_data.data)
|
||||
else:
|
||||
data = None
|
||||
if not event.event_data.data:
|
||||
return
|
||||
data = self.zk._bytesToDict(event.event_data.data)
|
||||
|
||||
# Perform an in-place update of the cached image if possible
|
||||
old_obj = self._cached_objects.get(key)
|
||||
|
|
Loading…
Reference in New Issue