mirror of
https://github.com/element-hq/synapse.git
synced 2024-12-19 09:31:35 +03:00
Switch to using a delta file
This commit is contained in:
parent
bc7a623980
commit
5f4b59d0ce
2 changed files with 6 additions and 8 deletions
|
@ -358,14 +358,7 @@ class DeviceInboxStore(DeviceInboxWorkerStore, DeviceInboxBackgroundUpdateStore)
|
||||||
def _add_messages_to_local_device_inbox_txn(
|
def _add_messages_to_local_device_inbox_txn(
|
||||||
self, txn, stream_id, messages_by_user_then_device
|
self, txn, stream_id, messages_by_user_then_device
|
||||||
):
|
):
|
||||||
# Compatible method of performing an upsert
|
sql = "UPDATE device_max_stream_id" " SET stream_id = ?" " WHERE stream_id < ?"
|
||||||
sql = """
|
|
||||||
INSERT INTO device_max_stream_id
|
|
||||||
(stream_id) VALUES (?)
|
|
||||||
ON CONFLICT DO UPDATE device_max_stream_id
|
|
||||||
SET stream_id = ?
|
|
||||||
WHERE stream_id < ?
|
|
||||||
"""
|
|
||||||
txn.execute(sql, (stream_id, stream_id))
|
txn.execute(sql, (stream_id, stream_id))
|
||||||
|
|
||||||
local_by_user_then_device = {}
|
local_by_user_then_device = {}
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
INSERT INTO device_max_stream_id (stream_id)
|
||||||
|
SELECT 0
|
||||||
|
WHERE NOT EXISTS (
|
||||||
|
SELECT 1 FROM device_max_stream_id
|
||||||
|
);
|
Loading…
Reference in a new issue