mirror of
https://github.com/element-hq/synapse
synced 2024-08-20 07:20:20 +00:00
SYN-367: Use upsert rather than insert_or_replace
This commit is contained in:
parent
2366d28780
commit
29400b45b9
1 changed files with 6 additions and 2 deletions
|
@ -137,8 +137,13 @@ class KeyStore(SQLBaseStore):
|
||||||
ts_valid_until_ms (int): The time when this json stops being valid.
|
ts_valid_until_ms (int): The time when this json stops being valid.
|
||||||
key_json (bytes): The encoded JSON.
|
key_json (bytes): The encoded JSON.
|
||||||
"""
|
"""
|
||||||
return self._simple_insert(
|
return self._simple_upsert(
|
||||||
table="server_keys_json",
|
table="server_keys_json",
|
||||||
|
keyvalues={
|
||||||
|
"server_name": server_name,
|
||||||
|
"key_id": key_id,
|
||||||
|
"from_server": from_server,
|
||||||
|
},
|
||||||
values={
|
values={
|
||||||
"server_name": server_name,
|
"server_name": server_name,
|
||||||
"key_id": key_id,
|
"key_id": key_id,
|
||||||
|
@ -147,7 +152,6 @@ class KeyStore(SQLBaseStore):
|
||||||
"ts_valid_until_ms": ts_expires_ms,
|
"ts_valid_until_ms": ts_expires_ms,
|
||||||
"key_json": buffer(key_json_bytes),
|
"key_json": buffer(key_json_bytes),
|
||||||
},
|
},
|
||||||
or_replace=True,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_server_keys_json(self, server_keys):
|
def get_server_keys_json(self, server_keys):
|
||||||
|
|
Loading…
Reference in a new issue