Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Fix returning incorrect prev_batch token in incremental sync #8486

Merged
merged 2 commits into from
Oct 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/8486.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix incremental sync returning an incorrect `prev_batch` token in timeline section, which when used to paginate returned events that were included in the incremental sync. Broken since v0.16.0.
7 changes: 6 additions & 1 deletion synapse/handlers/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,8 +460,13 @@ async def _load_filtered_recents(
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
Expand Down