0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-12-17 01:13:49 +01:00

SYN-258: get_recent_events_for_room only accepts stream tokens, convert the topological token to a stream token before passing it to get_recent_events_for_room

This commit is contained in:
Mark Haines 2015-02-06 15:58:40 +00:00
parent 0cd66885e3
commit 55a186485c

View file

@ -298,15 +298,17 @@ class SyncHandler(BaseHandler):
load_limit = max(sync_config.limit * filtering_factor, 100) load_limit = max(sync_config.limit * filtering_factor, 100)
max_repeat = 3 # Only try a few times per room, otherwise max_repeat = 3 # Only try a few times per room, otherwise
room_key = now_token.room_key room_key = now_token.room_key
end_key = room_key
while limited and len(recents) < sync_config.limit and max_repeat: while limited and len(recents) < sync_config.limit and max_repeat:
events, keys = yield self.store.get_recent_events_for_room( events, keys = yield self.store.get_recent_events_for_room(
room_id, room_id,
limit=load_limit + 1, limit=load_limit + 1,
from_token=since_token.room_key if since_token else None, from_token=since_token.room_key if since_token else None,
end_token=room_key, end_token=end_key,
) )
(room_key, _) = keys (room_key, _) = keys
end_key = "s" + room_key.split('-')[-1]
loaded_recents = sync_config.filter.filter_room_events(events) loaded_recents = sync_config.filter.filter_room_events(events)
loaded_recents.extend(recents) loaded_recents.extend(recents)
recents = loaded_recents recents = loaded_recents