Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit d0fe417

Browse files
authored
Remove unused store method _set_destination_retry_timings_emulated. (#15266)
1 parent de92fb6 commit d0fe417

File tree

2 files changed

+3
-54
lines changed

2 files changed

+3
-54
lines changed

changelog.d/15266.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Remove unused store method `_set_destination_retry_timings_emulated`.

synapse/storage/databases/main/transactions.py

Lines changed: 2 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -224,15 +224,15 @@ async def set_destination_retry_timings(
224224

225225
await self.db_pool.runInteraction(
226226
"set_destination_retry_timings",
227-
self._set_destination_retry_timings_native,
227+
self._set_destination_retry_timings_txn,
228228
destination,
229229
failure_ts,
230230
retry_last_ts,
231231
retry_interval,
232232
db_autocommit=True, # Safe as it's a single upsert
233233
)
234234

235-
def _set_destination_retry_timings_native(
235+
def _set_destination_retry_timings_txn(
236236
self,
237237
txn: LoggingTransaction,
238238
destination: str,
@@ -266,58 +266,6 @@ def _set_destination_retry_timings_native(
266266
txn, self.get_destination_retry_timings, (destination,)
267267
)
268268

269-
def _set_destination_retry_timings_emulated(
270-
self,
271-
txn: LoggingTransaction,
272-
destination: str,
273-
failure_ts: Optional[int],
274-
retry_last_ts: int,
275-
retry_interval: int,
276-
) -> None:
277-
self.database_engine.lock_table(txn, "destinations")
278-
279-
# We need to be careful here as the data may have changed from under us
280-
# due to a worker setting the timings.
281-
282-
prev_row = self.db_pool.simple_select_one_txn(
283-
txn,
284-
table="destinations",
285-
keyvalues={"destination": destination},
286-
retcols=("failure_ts", "retry_last_ts", "retry_interval"),
287-
allow_none=True,
288-
)
289-
290-
if not prev_row:
291-
self.db_pool.simple_insert_txn(
292-
txn,
293-
table="destinations",
294-
values={
295-
"destination": destination,
296-
"failure_ts": failure_ts,
297-
"retry_last_ts": retry_last_ts,
298-
"retry_interval": retry_interval,
299-
},
300-
)
301-
elif (
302-
retry_interval == 0
303-
or prev_row["retry_interval"] is None
304-
or prev_row["retry_interval"] < retry_interval
305-
):
306-
self.db_pool.simple_update_one_txn(
307-
txn,
308-
"destinations",
309-
keyvalues={"destination": destination},
310-
updatevalues={
311-
"failure_ts": failure_ts,
312-
"retry_last_ts": retry_last_ts,
313-
"retry_interval": retry_interval,
314-
},
315-
)
316-
317-
self._invalidate_cache_and_stream(
318-
txn, self.get_destination_retry_timings, (destination,)
319-
)
320-
321269
async def store_destination_rooms_entries(
322270
self,
323271
destinations: Iterable[str],

0 commit comments

Comments
 (0)