Compare commits

...

2 Commits

Author SHA1 Message Date
Erik Johnston
108d8093ab Newsfile 2024-06-24 17:44:25 +01:00
Erik Johnston
90ae0a67f5 Limit amount of replication we send 2024-06-24 17:42:22 +01:00
2 changed files with 5 additions and 2 deletions

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

@@ -0,0 +1 @@
Handle device lists notifications for large accounts more efficiently in worker mode.

View File

@@ -1035,14 +1035,16 @@ class DeviceWorkerStore(RoomMemberWorkerStore, EndToEndKeyWorkerStore):
SELECT stream_id, user_id, hosts FROM (
SELECT stream_id, user_id, false AS hosts FROM device_lists_stream
UNION ALL
SELECT DISTINCT stream_id, user_id, true AS hosts FROM device_lists_outbound_pokes
SELECT MAX(stream_id), user_id, true AS hosts FROM device_lists_outbound_pokes
WHERE ? < stream_id AND stream_id <= ?
GROUP BY user_id
) AS e
WHERE ? < stream_id AND stream_id <= ?
ORDER BY stream_id ASC
LIMIT ?
"""
txn.execute(sql, (last_id, current_id, limit))
txn.execute(sql, (last_id, current_id, last_id, current_id, limit))
updates = [(row[0], row[1:]) for row in txn]
limited = False
upto_token = current_id