mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-04 01:04:48 -04:00
Replace or_ignore
in simple_insert
with simple_upsert
(#10442)
Now that we have `simple_upsert` that should be used in preference to trying to insert and looking for an exception. The main benefit is that we ERROR message don't get written to postgres logs. We also have tidy up the return value on `simple_upsert`, rather than having a tri-state of inserted/not-inserted/unknown.
This commit is contained in:
parent
d8324b8238
commit
38b346a504
6 changed files with 44 additions and 99 deletions
|
@ -134,16 +134,18 @@ class TransactionWorkerStore(CacheInvalidationWorkerStore):
|
|||
response_dict: The response, to be encoded into JSON.
|
||||
"""
|
||||
|
||||
await self.db_pool.simple_insert(
|
||||
await self.db_pool.simple_upsert(
|
||||
table="received_transactions",
|
||||
values={
|
||||
keyvalues={
|
||||
"transaction_id": transaction_id,
|
||||
"origin": origin,
|
||||
},
|
||||
values={},
|
||||
insertion_values={
|
||||
"response_code": code,
|
||||
"response_json": db_binary_type(encode_canonical_json(response_dict)),
|
||||
"ts": self._clock.time_msec(),
|
||||
},
|
||||
or_ignore=True,
|
||||
desc="set_received_txn_response",
|
||||
)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue