From d9b4d919de7105eea9b515f8932c5efc9bdd8981 Mon Sep 17 00:00:00 2001 From: Patrick Cloke Date: Mon, 2 Mar 2020 15:48:25 -0500 Subject: [PATCH] Convert to async/await. --- synapse/federation/federation_client.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/synapse/federation/federation_client.py b/synapse/federation/federation_client.py index e7b79a0738e3..7dd608c1a5c0 100644 --- a/synapse/federation/federation_client.py +++ b/synapse/federation/federation_client.py @@ -346,15 +346,14 @@ async def get_room_state_ids( return state_event_ids, auth_event_ids - @defer.inlineCallbacks - def _check_sigs_and_hash_and_fetch( + async def _check_sigs_and_hash_and_fetch( self, origin: str, pdus: List[EventBase], room_version: str, outlier: bool = False, include_none: bool = False, - ): + ) -> List[EventBase]: """Takes a list of PDUs and checks the signatures and hashs of each one. If a PDU fails its signature check then we check if we have it in the database and if not then request if from the originating server of @@ -415,7 +414,7 @@ def handle_check_result(pdu: EventBase, deferred: Deferred): handle = preserve_fn(handle_check_result) deferreds2 = [handle(pdu, deferred) for pdu, deferred in zip(pdus, deferreds)] - valid_pdus = yield make_deferred_yieldable( + valid_pdus = await make_deferred_yieldable( defer.gatherResults(deferreds2, consumeErrors=True) ).addErrback(unwrapFirstError)