summary refs log tree commit diff
path: root/synapse/handlers/sliding_sync.py
diff options
context:
space:
mode:
Diffstat (limited to 'synapse/handlers/sliding_sync.py')
-rw-r--r--synapse/handlers/sliding_sync.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/synapse/handlers/sliding_sync.py b/synapse/handlers/sliding_sync.py
index 1238592917..543a1f8836 100644
--- a/synapse/handlers/sliding_sync.py
+++ b/synapse/handlers/sliding_sync.py
@@ -640,7 +640,7 @@ class SlidingSyncHandler:
         elif from_token:
             connection_token = from_token.connection
         else:
-            # Initial sync without a `from_token` starts a `0`
+            # Initial sync without a `from_token` starts at `0`
             connection_token = 0
 
         return SlidingSyncResult(
@@ -1467,8 +1467,9 @@ class SlidingSyncHandler:
 
             timeline_events, new_room_key = await self.store.paginate_room_events(
                 room_id=room_id,
-                # Because we want the latest events first the bounds are
-                # reversed.
+                # The bounds are reversed so we can paginate backwards
+                # (from newer to older events) starting at to_bound.
+                # This ensures we fill the `limit` with the newest events first,
                 from_key=to_bound,
                 to_key=from_bound,
                 direction=Direction.BACKWARDS,