diff options
author | Matthew Hodgson <matthew@matrix.org> | 2018-09-11 15:30:32 +0100 |
---|---|---|
committer | Matthew Hodgson <matthew@matrix.org> | 2018-09-11 15:30:32 +0100 |
commit | 934535fea58306a5f3be6106512ff874fccef550 (patch) | |
tree | b5dc0c557bd688e3a992fcde1b3a82493eeb89c7 | |
parent | fix pep8 (diff) | |
download | synapse-github/matthew/disable-ll-on-incr-syncs.tar.xz |
improve hero ordering github/matthew/disable-ll-on-incr-syncs matthew/disable-ll-on-incr-syncs
-rw-r--r-- | synapse/storage/roommember.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/synapse/storage/roommember.py b/synapse/storage/roommember.py index 002e3ec681..0707f9a86a 100644 --- a/synapse/storage/roommember.py +++ b/synapse/storage/roommember.py @@ -118,6 +118,8 @@ class RoomMemberWorkerStore(EventsWorkerStore): for count, membership in txn: summary = res.setdefault(to_ascii(membership), MemberSummary([], count)) + # we order by membership and then fairly arbitrarily by event_id so + # heroes are consistent sql = """ SELECT m.user_id, m.membership, m.event_id FROM room_memberships as m @@ -126,7 +128,9 @@ class RoomMemberWorkerStore(EventsWorkerStore): AND m.room_id = c.room_id AND m.user_id = c.state_key WHERE c.type = 'm.room.member' AND c.room_id = ? - ORDER BY CASE m.membership WHEN ? THEN 1 WHEN ? THEN 2 ELSE 3 END ASC + ORDER BY + CASE m.membership WHEN ? THEN 1 WHEN ? THEN 2 ELSE 3 END ASC, + m.event_id ASC LIMIT ? """ |