summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erikj@element.io>2024-07-23 11:38:09 +0100
committerGitHub <noreply@github.com>2024-07-23 11:38:09 +0100
commit6f738a4ab854cbae206ca3b0f4476aaf99c78202 (patch)
tree570c45518ece2cc40a5711de5cfa7cecaeeca481
parentMerge branch 'erikj/ss_tokens' into erikj/ss_room_store (diff)
downloadsynapse-6f738a4ab854cbae206ca3b0f4476aaf99c78202.tar.xz
Apply suggestions from code review
Co-authored-by: Eric Eastwood <eric.eastwood@beta.gouv.fr>
-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,