summary refs log tree commit diff
path: root/synapse/handlers/sync.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2020-10-07 13:49:40 +0100
committerGitHub <noreply@github.com>2020-10-07 13:49:40 +0100
commit9ca6341969b8b84c0c79a29fb914d1d8dbb3e320 (patch)
tree50b59bc15ce1d139fa3faef4eda0c36ef27ee308 /synapse/handlers/sync.py
parentunblacklist some tests (#8474) (diff)
downloadsynapse-9ca6341969b8b84c0c79a29fb914d1d8dbb3e320.tar.xz
Fix returning incorrect prev_batch token in incremental sync (#8486)
Diffstat (limited to 'synapse/handlers/sync.py')
-rw-r--r--synapse/handlers/sync.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/synapse/handlers/sync.py b/synapse/handlers/sync.py
index dd1f90e359..6fb8332f93 100644
--- a/synapse/handlers/sync.py
+++ b/synapse/handlers/sync.py
@@ -460,8 +460,13 @@ class SyncHandler:
                 recents = []
 
             if not limited or block_all_timeline:
+                prev_batch_token = now_token
+                if recents:
+                    room_key = recents[0].internal_metadata.before
+                    prev_batch_token = now_token.copy_and_replace("room_key", room_key)
+
                 return TimelineBatch(
-                    events=recents, prev_batch=now_token, limited=False
+                    events=recents, prev_batch=prev_batch_token, limited=False
                 )
 
             filtering_factor = 2