diff options
author | Erik Johnston <erik@matrix.org> | 2017-05-18 13:54:27 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2017-05-18 13:54:27 +0100 |
commit | 3accee1a8c2804620713ac4ff068a4a18a7de192 (patch) | |
tree | 5bfad3c1e8653713f8e14062732f892797279a92 /synapse/storage/deviceinbox.py | |
parent | Merge pull request #2136 from bbigras/patch-1 (diff) | |
parent | Bump changelog and version (diff) | |
download | synapse-3accee1a8c2804620713ac4ff068a4a18a7de192.tar.xz |
Merge branch 'release-v0.21.0' of github.com:matrix-org/synapse v0.21.0
Diffstat (limited to 'synapse/storage/deviceinbox.py')
-rw-r--r-- | synapse/storage/deviceinbox.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/synapse/storage/deviceinbox.py b/synapse/storage/deviceinbox.py index 2714519d21..0b62b493d5 100644 --- a/synapse/storage/deviceinbox.py +++ b/synapse/storage/deviceinbox.py @@ -325,23 +325,26 @@ class DeviceInboxStore(BackgroundUpdateStore): # we return. upper_pos = min(current_pos, last_pos + limit) sql = ( - "SELECT stream_id, user_id" + "SELECT max(stream_id), user_id" " FROM device_inbox" " WHERE ? < stream_id AND stream_id <= ?" - " ORDER BY stream_id ASC" + " GROUP BY user_id" ) txn.execute(sql, (last_pos, upper_pos)) rows = txn.fetchall() sql = ( - "SELECT stream_id, destination" + "SELECT max(stream_id), destination" " FROM device_federation_outbox" " WHERE ? < stream_id AND stream_id <= ?" - " ORDER BY stream_id ASC" + " GROUP BY destination" ) txn.execute(sql, (last_pos, upper_pos)) rows.extend(txn) + # Order by ascending stream ordering + rows.sort() + return rows return self.runInteraction( |