summary refs log tree commit diff
path: root/synapse/util/caches
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2018-04-13 11:16:43 +0100
committerRichard van der Hoff <richard@matrix.org>2018-04-13 11:16:43 +0100
commitd3347ad48553bd678fca7e3259d0824225cc6af2 (patch)
tree0d89b05c200daf4eec2af8c0042716760c3a9f7e /synapse/util/caches
parentMerge pull request #3092 from matrix-org/rav/response_cache_metrics (diff)
downloadsynapse-d3347ad48553bd678fca7e3259d0824225cc6af2.tar.xz
Revert "Use sortedcontainers instead of blist"
This reverts commit 9fbe70a7dc3afabfdac176ba1f4be32dd44602aa.

It turns out that sortedcontainers.SortedDict is not an exact match for
blist.sorteddict; in particular, `popitem()` removes things from the opposite
end of the dict.

This is trivial to fix, but I want to add some unit tests, and potentially some
more thought about it, before we do so.
Diffstat (limited to 'synapse/util/caches')
-rw-r--r--synapse/util/caches/stream_change_cache.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/synapse/util/caches/stream_change_cache.py b/synapse/util/caches/stream_change_cache.py
index 2ff46090a6..941d873ab8 100644
--- a/synapse/util/caches/stream_change_cache.py
+++ b/synapse/util/caches/stream_change_cache.py
@@ -16,7 +16,7 @@
 from synapse.util.caches import register_cache, CACHE_SIZE_FACTOR
 
 
-from sortedcontainers import SortedDict
+from blist import sorteddict
 import logging
 
 
@@ -35,7 +35,7 @@ class StreamChangeCache(object):
     def __init__(self, name, current_stream_pos, max_size=10000, prefilled_cache={}):
         self._max_size = int(max_size * CACHE_SIZE_FACTOR)
         self._entity_to_key = {}
-        self._cache = SortedDict()
+        self._cache = sorteddict()
         self._earliest_known_stream_pos = current_stream_pos
         self.name = name
         self.metrics = register_cache(self.name, self._cache)