summary refs log tree commit diff
path: root/synapse/rest
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2021-06-02 16:37:59 +0100
committerGitHub <noreply@github.com>2021-06-02 16:37:59 +0100
commitfc3d2dc269a79e0404d0a9867e5042354d59147f (patch)
tree53ac2672942797a76a2f673040b0535c318d6c43 /synapse/rest
parentDo not show invite-only rooms in spaces summary (unless joined/invited). (#10... (diff)
downloadsynapse-fc3d2dc269a79e0404d0a9867e5042354d59147f.tar.xz
Rewrite the KeyRing (#10035)
Diffstat (limited to 'synapse/rest')
-rw-r--r--synapse/rest/key/v2/remote_key_resource.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/synapse/rest/key/v2/remote_key_resource.py b/synapse/rest/key/v2/remote_key_resource.py
index aba1734a55..d56a1ae482 100644
--- a/synapse/rest/key/v2/remote_key_resource.py
+++ b/synapse/rest/key/v2/remote_key_resource.py
@@ -22,6 +22,7 @@ from synapse.crypto.keyring import ServerKeyFetcher
 from synapse.http.server import DirectServeJsonResource, respond_with_json
 from synapse.http.servlet import parse_integer, parse_json_object_from_request
 from synapse.util import json_decoder
+from synapse.util.async_helpers import yieldable_gather_results
 
 logger = logging.getLogger(__name__)
 
@@ -210,7 +211,13 @@ class RemoteKey(DirectServeJsonResource):
         # If there is a cache miss, request the missing keys, then recurse (and
         # ensure the result is sent).
         if cache_misses and query_remote_on_cache_miss:
-            await self.fetcher.get_keys(cache_misses)
+            await yieldable_gather_results(
+                lambda t: self.fetcher.get_keys(*t),
+                (
+                    (server_name, list(keys), 0)
+                    for server_name, keys in cache_misses.items()
+                ),
+            )
             await self.query_keys(request, query, query_remote_on_cache_miss=False)
         else:
             signed_keys = []