summary refs log tree commit diff
diff options
context:
space:
mode:
authorDavid Robertson <davidr@element.io>2022-10-01 21:49:12 +0100
committerDavid Robertson <davidr@element.io>2022-10-01 21:49:12 +0100
commitc7ee636762f03cfa3a1e16461e6746cdc15e578b (patch)
tree1d4193e43681f1c6c59b0a99e53ca8f533f9a3f9
parentSeparate runInteraction into simple and advanced (diff)
downloadsynapse-c7ee636762f03cfa3a1e16461e6746cdc15e578b.tar.xz
use `_advanced` function where isolation_level and db_autocommit is in use
-rw-r--r--synapse/module_api/__init__.py3
-rw-r--r--synapse/storage/databases/main/end_to_end_keys.py2
-rw-r--r--synapse/storage/databases/main/event_federation.py2
-rw-r--r--synapse/storage/databases/main/lock.py2
-rw-r--r--synapse/storage/databases/main/purge_events.py2
-rw-r--r--synapse/storage/databases/main/receipts.py2
-rw-r--r--synapse/storage/databases/main/transactions.py2
-rw-r--r--synapse/storage/util/id_generators.py2
8 files changed, 8 insertions, 9 deletions
diff --git a/synapse/module_api/__init__.py b/synapse/module_api/__init__.py

index b7b2d3b8c5..5d5a841b69 100644 --- a/synapse/module_api/__init__.py +++ b/synapse/module_api/__init__.py
@@ -831,9 +831,8 @@ class ModuleApi: Returns: Deferred[object]: result of func """ - # type-ignore: See https://github.com/python/mypy/issues/8862 return defer.ensureDeferred( - self._store.db_pool.runInteraction(desc, func, *args, **kwargs) # type: ignore[arg-type] + self._store.db_pool.runInteraction(desc, func, *args, **kwargs) ) def register_cached_function(self, cached_func: CachedFunction) -> None: diff --git a/synapse/storage/databases/main/end_to_end_keys.py b/synapse/storage/databases/main/end_to_end_keys.py
index 8e9e1b0b4b..91829ee1e4 100644 --- a/synapse/storage/databases/main/end_to_end_keys.py +++ b/synapse/storage/databases/main/end_to_end_keys.py
@@ -1082,7 +1082,7 @@ class EndToEndKeyWorkerStore(EndToEndKeyBackgroundStore, CacheInvalidationWorker _claim_e2e_one_time_key = _claim_e2e_one_time_key_simple db_autocommit = False - claim_row = await self.db_pool.runInteraction( + claim_row = await self.db_pool.runInteraction_advanced( "claim_e2e_one_time_keys", _claim_e2e_one_time_key, user_id, diff --git a/synapse/storage/databases/main/event_federation.py b/synapse/storage/databases/main/event_federation.py
index 6b9a629edd..f9ead4439a 100644 --- a/synapse/storage/databases/main/event_federation.py +++ b/synapse/storage/databases/main/event_federation.py
@@ -1689,7 +1689,7 @@ class EventFederationWorkerStore(SignatureWorkerStore, EventsWorkerStore, SQLBas return row[0] - return await self.db_pool.runInteraction( + return await self.db_pool.runInteraction_advanced( "remove_received_event_from_staging", _remove_received_event_from_staging_txn, db_autocommit=True, diff --git a/synapse/storage/databases/main/lock.py b/synapse/storage/databases/main/lock.py
index 7270ef09da..c65bac3efb 100644 --- a/synapse/storage/databases/main/lock.py +++ b/synapse/storage/databases/main/lock.py
@@ -162,7 +162,7 @@ class LockStore(SQLBaseStore): # We only acquired the lock if we inserted or updated the table. return bool(txn.rowcount) - did_lock = await self.db_pool.runInteraction( + did_lock = await self.db_pool.runInteraction_advanced( "try_acquire_lock", _try_acquire_lock_txn, # We can autocommit here as we're executing a single query, this diff --git a/synapse/storage/databases/main/purge_events.py b/synapse/storage/databases/main/purge_events.py
index 9213ce0b5a..96f95595ad 100644 --- a/synapse/storage/databases/main/purge_events.py +++ b/synapse/storage/databases/main/purge_events.py
@@ -325,7 +325,7 @@ class PurgeEventsStore(StateGroupWorkerStore, CacheInvalidationWorkerStore): # We then run the same purge a second time without this isolation level to # purge any of those rows which were added during the first. - state_groups_to_delete = await self.db_pool.runInteraction( + state_groups_to_delete = await self.db_pool.runInteraction_advanced( "purge_room", self._purge_room_txn, room_id=room_id, diff --git a/synapse/storage/databases/main/receipts.py b/synapse/storage/databases/main/receipts.py
index 246f78ac1f..55179ef3bb 100644 --- a/synapse/storage/databases/main/receipts.py +++ b/synapse/storage/databases/main/receipts.py
@@ -777,7 +777,7 @@ class ReceiptsWorkerStore(SQLBaseStore): ) async with self._receipts_id_gen.get_next() as stream_id: # type: ignore[attr-defined] - event_ts = await self.db_pool.runInteraction( + event_ts = await self.db_pool.runInteraction_advanced( "insert_linearized_receipt", self._insert_linearized_receipt_txn, room_id, diff --git a/synapse/storage/databases/main/transactions.py b/synapse/storage/databases/main/transactions.py
index f8c6877ee8..098ec5a1e3 100644 --- a/synapse/storage/databases/main/transactions.py +++ b/synapse/storage/databases/main/transactions.py
@@ -221,7 +221,7 @@ class TransactionWorkerStore(CacheInvalidationWorkerStore): retry_interval: how long until next retry in ms """ - await self.db_pool.runInteraction( + await self.db_pool.runInteraction_advanced( "set_destination_retry_timings", self._set_destination_retry_timings_native, destination, diff --git a/synapse/storage/util/id_generators.py b/synapse/storage/util/id_generators.py
index 2dfe4c0b66..677c0f8a1f 100644 --- a/synapse/storage/util/id_generators.py +++ b/synapse/storage/util/id_generators.py
@@ -818,7 +818,7 @@ class _MultiWriterCtxManager: # for. If we don't do this then we'll often hit serialization errors due # to the fact we default to REPEATABLE READ isolation levels. if self.id_gen._writers: - await self.id_gen._db.runInteraction( + await self.id_gen._db.runInteraction_advanced( "MultiWriterIdGenerator._update_table", self.id_gen._update_stream_positions_table_txn, db_autocommit=True,