diff options
author | Mathieu Velten <matmaul@gmail.com> | 2023-10-16 12:06:27 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-16 11:06:27 +0100 |
commit | eee6474bce4e387a05428de6f8291933ea6b72f7 (patch) | |
tree | 95bce9379d4471c6933959749e1557087006e68b /synapse/storage | |
parent | Bump jsonschema from 4.19.0 to 4.19.1 (#16500) (diff) | |
download | synapse-eee6474bce4e387a05428de6f8291933ea6b72f7.tar.xz |
Remove useless async job to delete device messages on sync (#16491)
Diffstat (limited to 'synapse/storage')
-rw-r--r-- | synapse/storage/databases/main/deviceinbox.py | 5 |
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)) |