From 97b21427aa01c6401752f8139dd8a986565dd235 Mon Sep 17 00:00:00 2001 From: Oskar Hahn Date: Tue, 10 Jan 2017 20:50:44 +0100 Subject: [PATCH] Change the way that missing cache ids are found. This is probalby faster but in any way it maks debugging a lot easier. To go though a big list in a for-loop is no fun at all. --- openslides/utils/collection.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/openslides/utils/collection.py b/openslides/utils/collection.py index 04fd5e027..448b00042 100644 --- a/openslides/utils/collection.py +++ b/openslides/utils/collection.py @@ -300,10 +300,10 @@ class Collection: cached_full_data_dict = cache.get_many(cache_keys) # Get all ids that are missing. - missing_ids = set() - for cache_key in cache_keys: - if cache_key not in cached_full_data_dict: - missing_ids.add(get_collection_id_from_cache_key(cache_key)[1]) + missing_cache_keys = set(cache_keys).difference(cached_full_data_dict.keys()) + missing_ids = set( + get_collection_id_from_cache_key(cache_key)[1] + for cache_key in missing_cache_keys) # Generate collection elements that where in the cache. for cache_key, cached_full_data in cached_full_data_dict.items():