summary refs log tree commit diff
diff options
context:
space:
mode:
authorAmber Brown <hawkowl@atleastfornow.net>2018-06-26 17:25:34 +0100
committerAmber Brown <hawkowl@atleastfornow.net>2018-06-26 17:25:34 +0100
commitabfe4b2957645194c59da359779a4d77dcc6f493 (patch)
tree777a995b84d38649eb22a022d287ff981f1984ac
parentMerge pull request #3438 from turt2live/travis/dont-print-access-tokens-in-logs (diff)
downloadsynapse-abfe4b2957645194c59da359779a4d77dcc6f493.tar.xz
try and make loading items from the cache faster
Diffstat (limited to '')
-rw-r--r--synapse/util/caches/stream_change_cache.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/synapse/util/caches/stream_change_cache.py b/synapse/util/caches/stream_change_cache.py
index 817118e30f..c81518c6bc 100644
--- a/synapse/util/caches/stream_change_cache.py
+++ b/synapse/util/caches/stream_change_cache.py
@@ -78,7 +78,8 @@ class StreamChangeCache(object):
             not_known_entities = set(entities) - set(self._entity_to_key)
 
             result = (
-                set(self._cache.values()[self._cache.bisect_right(stream_pos) :])
+                {self._cache[k] for k in in self._cache.islice(
+                    start=self._cache.bisect_right(stream_pos))}
                 .intersection(entities)
                 .union(not_known_entities)
             )
@@ -113,7 +114,8 @@ class StreamChangeCache(object):
         assert type(stream_pos) is int
 
         if stream_pos >= self._earliest_known_stream_pos:
-            return self._cache.values()[self._cache.bisect_right(stream_pos) :]
+            return {self._cache[k] for k in in self._cache.islice(
+                start=self._cache.bisect_right(stream_pos))}
         else:
             return None