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

Commit

Permalink
Fix returning incorrect prev_batch token in incremental sync (#8486)
Browse files Browse the repository at this point in the history
  • Loading branch information
erikjohnston committed Oct 7, 2020
1 parent d373ec2 commit 9ca6341
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
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

0 comments on commit 9ca6341

Please sign in to comment.