Ensure keys to RoomStreamChangeCache are ints
This commit is contained in:
parent
e1941442d4
commit
c23a8c7833
|
@ -199,6 +199,7 @@ class StreamStore(SQLBaseStore):
|
||||||
if from_key == to_key:
|
if from_key == to_key:
|
||||||
defer.returnValue(([], from_key))
|
defer.returnValue(([], from_key))
|
||||||
|
|
||||||
|
if from_id:
|
||||||
has_changed = yield self._events_stream_cache.get_room_has_changed(
|
has_changed = yield self._events_stream_cache.get_room_has_changed(
|
||||||
room_id, from_id
|
room_id, from_id
|
||||||
)
|
)
|
||||||
|
|
|
@ -39,6 +39,8 @@ class RoomStreamChangeCache(object):
|
||||||
caches_by_name[self.name] = self._cache
|
caches_by_name[self.name] = self._cache
|
||||||
|
|
||||||
def get_room_has_changed(self, room_id, key):
|
def get_room_has_changed(self, room_id, key):
|
||||||
|
assert type(key) is int
|
||||||
|
|
||||||
if key <= self._earliest_known_key:
|
if key <= self._earliest_known_key:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -55,6 +57,8 @@ class RoomStreamChangeCache(object):
|
||||||
"""Returns subset of room ids that have had new things since the
|
"""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.
|
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:
|
if key > self._earliest_known_key:
|
||||||
keys = self._cache.keys()
|
keys = self._cache.keys()
|
||||||
i = keys.bisect_right(key)
|
i = keys.bisect_right(key)
|
||||||
|
@ -73,6 +77,8 @@ class RoomStreamChangeCache(object):
|
||||||
def room_has_changed(self, room_id, key):
|
def room_has_changed(self, room_id, key):
|
||||||
"""Informs the cache that the room has been changed at the given 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:
|
if key > self._earliest_known_key:
|
||||||
old_key = self._room_to_key.get(room_id, None)
|
old_key = self._room_to_key.get(room_id, None)
|
||||||
if old_key:
|
if old_key:
|
||||||
|
|
Loading…
Reference in New Issue