diff options
author | Erik Johnston <erik@matrix.org> | 2020-02-07 13:56:38 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-07 13:56:38 +0000 |
commit | b08b0a22d505b1555f511e3f38935a62930ea25d (patch) | |
tree | 53cfe0c6c9d59e8d1b97affa473041692b056c96 /synapse/federation/sender/transaction_manager.py | |
parent | Allow moving group read APIs to workers (#6866) (diff) | |
download | synapse-b08b0a22d505b1555f511e3f38935a62930ea25d.tar.xz |
Add typing to synapse.federation.sender (#6871)
Diffstat (limited to 'synapse/federation/sender/transaction_manager.py')
-rw-r--r-- | synapse/federation/sender/transaction_manager.py | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/synapse/federation/sender/transaction_manager.py b/synapse/federation/sender/transaction_manager.py index 5fed626d5b..3c2a02a3b3 100644 --- a/synapse/federation/sender/transaction_manager.py +++ b/synapse/federation/sender/transaction_manager.py @@ -13,14 +13,15 @@ # See the License for the specific language governing permissions and # limitations under the License. import logging +from typing import List from canonicaljson import json -from twisted.internet import defer - +import synapse.server from synapse.api.errors import HttpResponseException +from synapse.events import EventBase from synapse.federation.persistence import TransactionActions -from synapse.federation.units import Transaction +from synapse.federation.units import Edu, Transaction from synapse.logging.opentracing import ( extract_text_map, set_tag, @@ -39,7 +40,7 @@ class TransactionManager(object): shared between PerDestinationQueue objects """ - def __init__(self, hs): + 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() @@ -50,8 +51,9 @@ class TransactionManager(object): self._next_txn_id = int(self.clock.time_msec()) @measure_func("_send_new_transaction") - @defer.inlineCallbacks - def send_new_transaction(self, destination, pending_pdus, pending_edus): + async def send_new_transaction( + self, destination: str, pending_pdus: List[EventBase], pending_edus: List[Edu] + ): # Make a transaction-sending opentracing span. This span follows on from # all the edus in that transaction. This needs to be done since there is @@ -127,7 +129,7 @@ class TransactionManager(object): return data try: - response = yield self._transport_layer.send_transaction( + response = await self._transport_layer.send_transaction( transaction, json_data_cb ) code = 200 |