mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-12-23 15:39:29 -05: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
|
self._next_stream_id = int(hs.get_clock().time_msec()) * 1000
|
||||||
|
|
||||||
def insert_client_ip(self, user, access_token, device_id, ip, user_agent):
|
def insert_client_ip(self, user, access_token, device_id, ip, user_agent):
|
||||||
return self._simple_insert(
|
return self._simple_upsert(
|
||||||
"user_ips",
|
"user_ips",
|
||||||
{
|
keyvalues={
|
||||||
"user": user.to_string(),
|
"user": user.to_string(),
|
||||||
"access_token": access_token,
|
"access_token": access_token,
|
||||||
"device_id": device_id,
|
|
||||||
"ip": ip,
|
"ip": ip,
|
||||||
"user_agent": user_agent,
|
"user_agent": user_agent,
|
||||||
|
},
|
||||||
|
values={
|
||||||
|
"device_id": device_id,
|
||||||
"last_seen": int(self._clock.time_msec()),
|
"last_seen": int(self._clock.time_msec()),
|
||||||
},
|
},
|
||||||
desc="insert_client_ip",
|
desc="insert_client_ip",
|
||||||
|
@ -84,14 +84,14 @@ class TransactionStore(SQLBaseStore):
|
|||||||
|
|
||||||
def _set_received_txn_response(self, txn, transaction_id, origin, code,
|
def _set_received_txn_response(self, txn, transaction_id, origin, code,
|
||||||
response_json):
|
response_json):
|
||||||
self._simple_update_one_txn(
|
self._simple_upsert_txn(
|
||||||
txn,
|
txn,
|
||||||
table=ReceivedTransactionsTable.table_name,
|
table=ReceivedTransactionsTable.table_name,
|
||||||
keyvalues={
|
keyvalues={
|
||||||
"transaction_id": transaction_id,
|
"transaction_id": transaction_id,
|
||||||
"origin": origin,
|
"origin": origin,
|
||||||
},
|
},
|
||||||
updatevalues={
|
values={
|
||||||
"response_code": code,
|
"response_code": code,
|
||||||
"response_json": response_json,
|
"response_json": response_json,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user