Skip to content

Commit f30a0d9

Browse files
richvdhphil-flex
authored andcommitted
Remove sent outbound device list pokes from the database (matrix-org#7192)
They just get in the way.
1 parent 7f6020a commit f30a0d9

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

changelog.d/7192.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Remove sent outbound device list pokes from the database.

synapse/storage/data_stores/main/devices.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,11 +227,11 @@ def _get_device_updates_by_remote_txn(
227227
# get the list of device updates that need to be sent
228228
sql = """
229229
SELECT user_id, device_id, stream_id, opentracing_context FROM device_lists_outbound_pokes
230-
WHERE destination = ? AND ? < stream_id AND stream_id <= ? AND sent = ?
230+
WHERE destination = ? AND ? < stream_id AND stream_id <= ?
231231
ORDER BY stream_id
232232
LIMIT ?
233233
"""
234-
txn.execute(sql, (destination, from_stream_id, now_stream_id, False, limit))
234+
txn.execute(sql, (destination, from_stream_id, now_stream_id, limit))
235235

236236
return list(txn)
237237

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/* Copyright 2020 The Matrix.org Foundation C.I.C
2+
*
3+
* Licensed under the Apache License, Version 2.0 (the "License");
4+
* you may not use this file except in compliance with the License.
5+
* You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software
10+
* distributed under the License is distributed on an "AS IS" BASIS,
11+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
* See the License for the specific language governing permissions and
13+
* limitations under the License.
14+
*/
15+
16+
-- we no longer keep sent outbound device pokes in the db; clear them out
17+
-- so that we don't have to worry about them.
18+
--
19+
-- This is a sequence scan, but it doesn't take too long.
20+
21+
DELETE FROM device_lists_outbound_pokes WHERE sent;

0 commit comments

Comments
 (0)