simplify cache generation

don't use lambda to filter. this is 25% faster but really negligible.

Change-Id: Ib76470fc3a5cdfc79e497d568147b66c08e6dba1
This commit is contained in:
gord chung 2017-11-23 15:14:29 -05:00
parent bd464f1f57
commit 8e3ba4d709
1 changed files with 2 additions and 2 deletions

View File

@ -461,8 +461,8 @@ class GnocchiPublisher(publisher.ConfigPublisherBase):
def _check_resource_cache(self, key, resource_data):
cached_hash = self.cache.get(key)
attribute_hash = hash(frozenset(filter(lambda x: x[0] != "metrics",
resource_data.items())))
attribute_hash = hash(tuple(i for i in resource_data.items()
if i[0] != 'metrics'))
if not cached_hash or cached_hash != attribute_hash:
return attribute_hash
else: