Skip to content

Commit 524b93f

Browse files
committed
Inline SQL
1 parent 756675c commit 524b93f

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

synapse/storage/databases/main/devices.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1780,12 +1780,6 @@ async def get_device_list_changes_in_rooms(
17801780
if not changed_room_ids:
17811781
return set()
17821782

1783-
sql = """
1784-
SELECT user_id, stream_id, instance_name
1785-
FROM device_lists_changes_in_room
1786-
WHERE {clause} AND stream_id > ? AND stream_id <= ?
1787-
"""
1788-
17891783
def _get_device_list_changes_in_rooms_txn(
17901784
txn: LoggingTransaction,
17911785
) -> set[str] | None:
@@ -1803,7 +1797,12 @@ def _get_device_list_changes_in_rooms_txn(
18031797
args.append(from_token.stream)
18041798
args.append(to_token.get_max_stream_pos())
18051799

1806-
txn.execute(sql.format(clause=clause), args)
1800+
sql = f"""
1801+
SELECT user_id, stream_id, instance_name
1802+
FROM device_lists_changes_in_room
1803+
WHERE {clause} AND stream_id > ? AND stream_id <= ?
1804+
"""
1805+
txn.execute(sql, args)
18071806
changes.update(
18081807
user_id
18091808
for (user_id, stream_id, instance_name) in txn

0 commit comments

Comments
 (0)