mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-12-30 18:06:25 -05:00
Use 'update or insert' rather than on 'conflict replace'
This commit is contained in:
parent
278149f533
commit
d5272b1d2c
@ -276,26 +276,33 @@ class TransactionStore(SQLBaseStore):
|
|||||||
retry_interval,
|
retry_interval,
|
||||||
)
|
)
|
||||||
|
|
||||||
def _set_destination_retry_timings(cls, txn, destination,
|
def _set_destination_retry_timings(self, txn, destination,
|
||||||
retry_last_ts, retry_interval):
|
retry_last_ts, retry_interval):
|
||||||
|
|
||||||
query = (
|
query = (
|
||||||
"INSERT INTO destinations"
|
"UPDATE destinations"
|
||||||
" (destination, retry_last_ts, retry_interval)"
|
" SET retry_last_ts = ?, retry_interval = ?"
|
||||||
" VALUES (?, ?, ?)"
|
" WHERE destinations = ?"
|
||||||
" ON DUPLICATE KEY UPDATE"
|
|
||||||
" retry_last_ts=?, retry_interval=?"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
txn.execute(
|
txn.execute(
|
||||||
query,
|
query,
|
||||||
(
|
(
|
||||||
destination,
|
retry_last_ts, retry_interval, destination,
|
||||||
retry_last_ts, retry_interval,
|
|
||||||
retry_last_ts, retry_interval,
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if txn.rowcount == 0:
|
||||||
|
# destination wasn't already in table. Insert it.
|
||||||
|
self._simple_insert_txn(
|
||||||
|
txn,
|
||||||
|
table="destinations",
|
||||||
|
values={
|
||||||
|
"destination": destination,
|
||||||
|
"retry_last_ts": retry_last_ts,
|
||||||
|
"retry_interval": retry_interval,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
def get_destinations_needing_retry(self):
|
def get_destinations_needing_retry(self):
|
||||||
"""Get all destinations which are due a retry for sending a transaction.
|
"""Get all destinations which are due a retry for sending a transaction.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user