summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2018-05-09 15:56:07 +0100
committerErik Johnston <erik@matrix.org>2018-05-09 15:56:07 +0100
commitd26bec8a437e44a05febd02473a8dcd8ff2c9f58 (patch)
tree42ba251d96dadc0dd32a8e76baac0d23f2b1d3c0
parentRefactor sync APIs to reuse pagination API (diff)
downloadsynapse-d26bec8a437e44a05febd02473a8dcd8ff2c9f58.tar.xz
Add comment to sync as to why code path is split
-rw-r--r--synapse/handlers/sync.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/synapse/handlers/sync.py b/synapse/handlers/sync.py
index b75daa340d..263e42dded 100644
--- a/synapse/handlers/sync.py
+++ b/synapse/handlers/sync.py
@@ -354,6 +354,11 @@ class SyncHandler(object):
                 since_key = since_token.room_key
 
             while limited and len(recents) < timeline_limit and max_repeat:
+                # If we have a since_key then we are trying to get any events
+                # that have happened since `since_key` up to `end_key`, so we
+                # can just use `get_room_events_stream_for_room`.
+                # Otherwise, we want to return the last N events in the room
+                # in toplogical ordering.
                 if since_key:
                     events, end_key = yield self.store.get_room_events_stream_for_room(
                         room_id,