mirror of
https://mau.dev/maunium/synapse.git
synced 2024-10-01 01:36:05 -04:00
Use _simple_upsert
This commit is contained in:
parent
6e7131f02f
commit
9115421ace
@ -81,14 +81,16 @@ class DataStore(RoomMemberStore, RoomStore,
|
||||
self._next_stream_id = int(hs.get_clock().time_msec()) * 1000
|
||||
|
||||
def insert_client_ip(self, user, access_token, device_id, ip, user_agent):
|
||||
return self._simple_insert(
|
||||
return self._simple_upsert(
|
||||
"user_ips",
|
||||
{
|
||||
keyvalues={
|
||||
"user": user.to_string(),
|
||||
"access_token": access_token,
|
||||
"device_id": device_id,
|
||||
"ip": ip,
|
||||
"user_agent": user_agent,
|
||||
},
|
||||
values={
|
||||
"device_id": device_id,
|
||||
"last_seen": int(self._clock.time_msec()),
|
||||
},
|
||||
desc="insert_client_ip",
|
||||
|
@ -84,14 +84,14 @@ class TransactionStore(SQLBaseStore):
|
||||
|
||||
def _set_received_txn_response(self, txn, transaction_id, origin, code,
|
||||
response_json):
|
||||
self._simple_update_one_txn(
|
||||
self._simple_upsert_txn(
|
||||
txn,
|
||||
table=ReceivedTransactionsTable.table_name,
|
||||
keyvalues={
|
||||
"transaction_id": transaction_id,
|
||||
"origin": origin,
|
||||
},
|
||||
updatevalues={
|
||||
values={
|
||||
"response_code": code,
|
||||
"response_json": response_json,
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user