summary refs log tree commit diff
path: root/synapse/util/caches/stream_change_cache.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-01-28 18:05:43 +0000
committerErik Johnston <erik@matrix.org>2016-01-28 18:05:43 +0000
commit40431251cba7ef1b623559db972600ece40818a4 (patch)
treecc17ad545ebd200d91f27f77605e39ae834f8fd1 /synapse/util/caches/stream_change_cache.py
parentFix inequalities (diff)
downloadsynapse-40431251cba7ef1b623559db972600ece40818a4.tar.xz
Correctly update _entity_to_key
Diffstat (limited to 'synapse/util/caches/stream_change_cache.py')
-rw-r--r--synapse/util/caches/stream_change_cache.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/synapse/util/caches/stream_change_cache.py b/synapse/util/caches/stream_change_cache.py
index 483e0cdf96..22a9f8f467 100644
--- a/synapse/util/caches/stream_change_cache.py
+++ b/synapse/util/caches/stream_change_cache.py
@@ -82,18 +82,19 @@ class StreamChangeCache(object):
 
         return result
 
-    def entity_has_changed(self, entitiy, stream_pos):
-        """Informs the cache that the entitiy has been changed at the given
+    def entity_has_changed(self, entity, stream_pos):
+        """Informs the cache that the entity has been changed at the given
         position.
         """
         assert type(stream_pos) is int
 
         if stream_pos > self._earliest_known_stream_pos:
-            old_pos = self._entity_to_key.get(entitiy, None)
+            old_pos = self._entity_to_key.get(entity, None)
             if old_pos:
                 stream_pos = max(stream_pos, old_pos)
                 self._cache.pop(old_pos, None)
-            self._cache[stream_pos] = entitiy
+            self._cache[stream_pos] = entity
+            self._entity_to_key[entity] = stream_pos
 
             while len(self._cache) > self._max_size:
                 k, r = self._cache.popitem()