From 00c886c8b0fa579e84179967c00b2800ea6ce73e Mon Sep 17 00:00:00 2001 From: Crag Wolfe Date: Wed, 8 Feb 2017 01:45:09 +0000 Subject: [PATCH] Only reset current resource's attrs in state_set There is no need to reset other resources' attributes in the stack when a resource calls state_set(), the other resources attributes will get updated as they are visited. This is not a huge performance gain since those resources would have been in memory anyway, but let's not use the big hammer if we don't have to. Change-Id: Icafd770055a3dc2f1f3262753a8dca045e38972d --- heat/engine/resource.py | 2 +- heat/engine/stack.py | 9 --------- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/heat/engine/resource.py b/heat/engine/resource.py index 613cefe590..908cd06fee 100644 --- a/heat/engine/resource.py +++ b/heat/engine/resource.py @@ -2014,7 +2014,7 @@ class Resource(object): if new_state != old_state: self._add_event(action, status, reason) - self.stack.reset_resource_attributes() + self.attributes.reset_resolved_values() @property def state(self): diff --git a/heat/engine/stack.py b/heat/engine/stack.py index df8cb1d274..80c36573fd 100644 --- a/heat/engine/stack.py +++ b/heat/engine/stack.py @@ -2007,15 +2007,6 @@ class Stack(collections.Mapping): 'tags': self.tags, } - def reset_resource_attributes(self): - # nothing is cached if no resources exist - if not self._resources: - return - # a change in some resource may have side-effects in the attributes - # of other resources, so ensure that attributes are re-calculated - for res in six.itervalues(self.resources): - res.attributes.reset_resolved_values() - def has_cache_data(self, resource_name): return (self.cache_data is not None and self.cache_data.get(resource_name) is not None)