diff options
author | Erik Johnston <erik@matrix.org> | 2016-01-28 15:55:26 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2016-01-28 15:55:26 +0000 |
commit | c23a8c783382a0789c757e16e104cf08654e6cf8 (patch) | |
tree | a00b36f2352eb555ae6e8e0e474d9a41ea27cadc /synapse/util/caches/room_change_cache.py | |
parent | Invalidate caches properly. Remove unused arg (diff) | |
download | synapse-c23a8c783382a0789c757e16e104cf08654e6cf8.tar.xz |
Ensure keys to RoomStreamChangeCache are ints
Diffstat (limited to 'synapse/util/caches/room_change_cache.py')
-rw-r--r-- | synapse/util/caches/room_change_cache.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/synapse/util/caches/room_change_cache.py b/synapse/util/caches/room_change_cache.py index eb2ab5f1e4..e8bfedd72f 100644 --- a/synapse/util/caches/room_change_cache.py +++ b/synapse/util/caches/room_change_cache.py @@ -39,6 +39,8 @@ class RoomStreamChangeCache(object): caches_by_name[self.name] = self._cache def get_room_has_changed(self, room_id, key): + assert type(key) is int + if key <= self._earliest_known_key: return True @@ -55,6 +57,8 @@ class RoomStreamChangeCache(object): """Returns subset of room ids that have had new things since the given key. If the key is too old it will just return the given list. """ + assert type(key) is int + if key > self._earliest_known_key: keys = self._cache.keys() i = keys.bisect_right(key) @@ -73,6 +77,8 @@ class RoomStreamChangeCache(object): def room_has_changed(self, room_id, key): """Informs the cache that the room has been changed at the given key. """ + assert type(key) is int + if key > self._earliest_known_key: old_key = self._room_to_key.get(room_id, None) if old_key: |