Fix background update for sliding sync (find previous membership) (#17632)

This reverts commit
ab414f2ab8.

Introduced in https://github.com/element-hq/synapse/pull/17512
This commit is contained in:
Erik Johnston 2024-08-29 19:16:39 +01:00 committed by GitHub
parent bb80894391
commit d844afdc29
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 4 deletions

1
changelog.d/17632.misc Normal file
View File

@ -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.

View File

@ -1967,12 +1967,13 @@ class EventsBackgroundUpdatesStore(StreamWorkerStore, StateDeltasStore, SQLBaseS
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
""",
(