summary refs log tree commit diff
path: root/synapse/federation
diff options
context:
space:
mode:
authorPatrick Cloke <clokep@users.noreply.github.com>2020-08-27 13:38:41 -0400
committerGitHub <noreply@github.com>2020-08-27 13:38:41 -0400
commit9b7ac03af3e7ceae7d1933db566ee407cfdef72d (patch)
treebd29b6da47cb08b846e05ce004f0e8d4008ed374 /synapse/federation
parentsimple_search_list_txn should return None, not 0. (#8187) (diff)
downloadsynapse-9b7ac03af3e7ceae7d1933db566ee407cfdef72d.tar.xz
Convert calls of async database methods to async (#8166)
Diffstat (limited to 'synapse/federation')
-rw-r--r--synapse/federation/persistence.py16
-rw-r--r--synapse/federation/units.py4
2 files changed, 10 insertions, 10 deletions
diff --git a/synapse/federation/persistence.py b/synapse/federation/persistence.py
index d68b4bd670..769cd5de28 100644
--- a/synapse/federation/persistence.py
+++ b/synapse/federation/persistence.py
@@ -21,7 +21,9 @@ These actions are mostly only used by the :py:mod:`.replication` module.
 
 import logging
 
+from synapse.federation.units import Transaction
 from synapse.logging.utils import log_function
+from synapse.types import JsonDict
 
 logger = logging.getLogger(__name__)
 
@@ -49,15 +51,15 @@ class TransactionActions(object):
         return self.store.get_received_txn_response(transaction.transaction_id, origin)
 
     @log_function
-    def set_response(self, origin, transaction, code, response):
+    async def set_response(
+        self, origin: str, transaction: Transaction, code: int, response: JsonDict
+    ) -> None:
         """ Persist how we responded to a transaction.
-
-        Returns:
-            Deferred
         """
-        if not transaction.transaction_id:
+        transaction_id = transaction.transaction_id  # type: ignore
+        if not transaction_id:
             raise RuntimeError("Cannot persist a transaction with no transaction_id")
 
-        return self.store.set_received_txn_response(
-            transaction.transaction_id, origin, code, response
+        await self.store.set_received_txn_response(
+            transaction_id, origin, code, response
         )
diff --git a/synapse/federation/units.py b/synapse/federation/units.py
index 6b32e0dcbf..64d98fc8f6 100644
--- a/synapse/federation/units.py
+++ b/synapse/federation/units.py
@@ -107,9 +107,7 @@ class Transaction(JsonEncodedObject):
         if "edus" in kwargs and not kwargs["edus"]:
             del kwargs["edus"]
 
-        super(Transaction, self).__init__(
-            transaction_id=transaction_id, pdus=pdus, **kwargs
-        )
+        super().__init__(transaction_id=transaction_id, pdus=pdus, **kwargs)
 
     @staticmethod
     def create_new(pdus, **kwargs):