summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2018-12-01 04:14:46 +0000
committerGerrit Code Review <review@openstack.org>2018-12-01 04:14:46 +0000
commitaab51a7570d8be71617f7fb1484106c1ae803ffd (patch)
tree5eb9f6cdcb26a3b521e2e20b80e243b11b691ffe
parentb53f52653bb85c44535fbb10bff975e36f2a42b7 (diff)
parent3e675082baa8884a27e4eb2d934df33edea89228 (diff)
Merge "Don't update caches with empty zNodes"
-rwxr-xr-xnodepool/zk.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/nodepool/zk.py b/nodepool/zk.py
index 4347b41..ca02502 100755
--- a/nodepool/zk.py
+++ b/nodepool/zk.py
@@ -2113,6 +2113,10 @@ class ZooKeeper(object):
2113 node_id = path.rsplit('/', 1)[1] 2113 node_id = path.rsplit('/', 1)[1]
2114 2114
2115 if event.event_type in (TreeEvent.NODE_ADDED, TreeEvent.NODE_UPDATED): 2115 if event.event_type in (TreeEvent.NODE_ADDED, TreeEvent.NODE_UPDATED):
2116 # Nodes with empty data are invalid so skip add or update these.
2117 if not event.event_data.data:
2118 return
2119
2116 # Perform an in-place update of the already cached node if possible 2120 # Perform an in-place update of the already cached node if possible
2117 d = self._bytesToDict(event.event_data.data) 2121 d = self._bytesToDict(event.event_data.data)
2118 old_node = self._cached_nodes.get(node_id) 2122 old_node = self._cached_nodes.get(node_id)
@@ -2176,6 +2180,10 @@ class ZooKeeper(object):
2176 request_id = path.rsplit('/', 1)[1] 2180 request_id = path.rsplit('/', 1)[1]
2177 2181
2178 if event.event_type in (TreeEvent.NODE_ADDED, TreeEvent.NODE_UPDATED): 2182 if event.event_type in (TreeEvent.NODE_ADDED, TreeEvent.NODE_UPDATED):
2183 # Requests with empty data are invalid so skip add or update these.
2184 if not event.event_data.data:
2185 return
2186
2179 # Perform an in-place update of the cached request if possible 2187 # Perform an in-place update of the cached request if possible
2180 d = self._bytesToDict(event.event_data.data) 2188 d = self._bytesToDict(event.event_data.data)
2181 old_request = self._cached_node_requests.get(request_id) 2189 old_request = self._cached_node_requests.get(request_id)