summary refs log tree commit diff
path: root/synapse/storage
diff options
context:
space:
mode:
authorMathieu Velten <matmaul@gmail.com>2023-10-13 14:11:03 +0200
committerMathieu Velten <matmaul@gmail.com>2023-10-13 16:16:43 +0200
commitb2559e1981370d1cf02895acdf7a5b551e70ace7 (patch)
treed0bd8394fee60b5600a183eab7de8f9de237e1e5 /synapse/storage
parentFix typo in useful_sql_for_admins.md (#16477) (diff)
downloadsynapse-github/improve-sync-delete-device-msgs.tar.xz
Remove useless async job to delete device messages on sync github/improve-sync-delete-device-msgs improve-sync-delete-device-msgs
Diffstat (limited to 'synapse/storage')
-rw-r--r--synapse/storage/databases/main/deviceinbox.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/synapse/storage/databases/main/deviceinbox.py b/synapse/storage/databases/main/deviceinbox.py

index 1cf649d371..1faa6f04b2 100644 --- a/synapse/storage/databases/main/deviceinbox.py +++ b/synapse/storage/databases/main/deviceinbox.py
@@ -450,7 +450,7 @@ class DeviceInboxWorkerStore(SQLBaseStore): user_id: str, device_id: Optional[str], up_to_stream_id: int, - limit: int, + limit: Optional[int] = None, ) -> int: """ Args: @@ -481,11 +481,12 @@ class DeviceInboxWorkerStore(SQLBaseStore): ROW_ID_NAME = self.database_engine.row_id_name def delete_messages_for_device_txn(txn: LoggingTransaction) -> int: + limit_statement = "" if limit is None else f"LIMIT {limit}" sql = f""" DELETE FROM device_inbox WHERE {ROW_ID_NAME} IN ( SELECT {ROW_ID_NAME} FROM device_inbox WHERE user_id = ? AND device_id = ? AND stream_id <= ? - LIMIT {limit} + {limit_statement} ) """ txn.execute(sql, (user_id, device_id, up_to_stream_id))