Skip to content

Commit

Permalink
Fix background update for sliding sync (find previous membership) (#1…
Browse files Browse the repository at this point in the history
…7632)

This reverts commit
ab414f2.

Introduced in #17512
  • Loading branch information
erikjohnston authored Aug 29, 2024
1 parent bb80894 commit d844afd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions changelog.d/17632.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Pre-populate room data used in experimental [MSC3575](https://github.com/matrix-org/matrix-spec-proposals/pull/3575) Sliding Sync `/sync` endpoint for quick filtering/sorting.
9 changes: 5 additions & 4 deletions synapse/storage/databases/main/events_bg_updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -1967,12 +1967,13 @@ def _find_previous_membership_txn(
txn.execute(
"""
SELECT event_id, membership
FROM room_memberships
FROM room_memberships AS m
INNER JOIN events AS e USING (room_id, event_id)
WHERE
room_id = ?
AND user_id = ?
AND event_stream_ordering < ?
ORDER BY event_stream_ordering DESC
AND m.user_id = ?
AND e.stream_ordering < ?
ORDER BY e.stream_ordering DESC
LIMIT 1
""",
(
Expand Down

0 comments on commit d844afd

Please sign in to comment.