Remove `HomeServer.get_datastore()` (#12031)
The presence of this method was confusing, and mostly present for backwards
compatibility. Let's get rid of it.
Part of #11733
3 files changed, 7 insertions, 6 deletions
diff --git a/synapse/federation/sender/__init__.py b/synapse/federation/sender/__init__.py
index 720d7bd74d..6106a486d1 100644
--- a/synapse/federation/sender/__init__.py
+++ b/synapse/federation/sender/__init__.py
@@ -228,7 +228,7 @@ class FederationSender(AbstractFederationSender):
self.hs = hs
self.server_name = hs.hostname
- self.store = hs.get_datastore()
+ self.store = hs.get_datastores().main
self.state = hs.get_state_handler()
self.clock = hs.get_clock()
diff --git a/synapse/federation/sender/per_destination_queue.py b/synapse/federation/sender/per_destination_queue.py
index c3132f7319..c8768f22bc 100644
--- a/synapse/federation/sender/per_destination_queue.py
+++ b/synapse/federation/sender/per_destination_queue.py
@@ -76,7 +76,7 @@ class PerDestinationQueue:
):
self._server_name = hs.hostname
self._clock = hs.get_clock()
- self._store = hs.get_datastore()
+ self._store = hs.get_datastores().main
self._transaction_manager = transaction_manager
self._instance_name = hs.get_instance_name()
self._federation_shard_config = hs.config.worker.federation_shard_config
@@ -381,9 +381,8 @@ class PerDestinationQueue:
)
)
- last_successful_stream_ordering = self._last_successful_stream_ordering
-
- if last_successful_stream_ordering is None:
+ _tmp_last_successful_stream_ordering = self._last_successful_stream_ordering
+ if _tmp_last_successful_stream_ordering is None:
# if it's still None, then this means we don't have the information
# in our database we haven't successfully sent a PDU to this server
# (at least since the introduction of the feature tracking
@@ -393,6 +392,8 @@ class PerDestinationQueue:
self._catching_up = False
return
+ last_successful_stream_ordering: int = _tmp_last_successful_stream_ordering
+
# get at most 50 catchup room/PDUs
while True:
event_ids = await self._store.get_catch_up_room_event_ids(
diff --git a/synapse/federation/sender/transaction_manager.py b/synapse/federation/sender/transaction_manager.py
index 742ee57255..0c1cad86ab 100644
--- a/synapse/federation/sender/transaction_manager.py
+++ b/synapse/federation/sender/transaction_manager.py
@@ -53,7 +53,7 @@ class TransactionManager:
def __init__(self, hs: "synapse.server.HomeServer"):
self._server_name = hs.hostname
self.clock = hs.get_clock() # nb must be called this for @measure_func
- self._store = hs.get_datastore()
+ self._store = hs.get_datastores().main
self._transaction_actions = TransactionActions(self._store)
self._transport_layer = hs.get_federation_transport_client()
|