summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorErik Johnston <erikj@jki.re>2018-07-17 11:16:59 +0100
committerGitHub <noreply@github.com>2018-07-17 11:16:59 +0100
commitc7320a5564c15a8f8e37a8562a4f434a20180daf (patch)
tree91bcc61fb57e0b62787486aaba875bfa183f5a44 /synapse
parentMerge pull request #3530 from matrix-org/erikj/stream_cache (diff)
parentUse efficient .intersection (diff)
downloadsynapse-c7320a5564c15a8f8e37a8562a4f434a20180daf.tar.xz
Merge pull request #3544 from matrix-org/erikj/fixup_stream_cache
Fix perf regression in PR #3530
Diffstat (limited to 'synapse')
-rw-r--r--synapse/util/caches/stream_change_cache.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/synapse/util/caches/stream_change_cache.py b/synapse/util/caches/stream_change_cache.py
index 258655349b..f2bde74dc5 100644
--- a/synapse/util/caches/stream_change_cache.py
+++ b/synapse/util/caches/stream_change_cache.py
@@ -74,12 +74,14 @@ class StreamChangeCache(object):
         assert type(stream_pos) is int
 
         if stream_pos >= self._earliest_known_stream_pos:
-            result = {
+            changed_entities = {
                 self._cache[k] for k in self._cache.islice(
                     start=self._cache.bisect_right(stream_pos),
                 )
             }
 
+            result = changed_entities.intersection(entities)
+
             self.metrics.inc_hits()
         else:
             result = set(entities)