summary refs log tree commit diff
diff options
context:
space:
mode:
authorDavid Robertson <davidr@element.io>2023-02-24 00:00:11 +0000
committerDavid Robertson <davidr@element.io>2023-02-24 00:33:04 +0000
commit8c5067609cb68f2f00a4b1d9011ea278608adcd1 (patch)
tree1b1294f8199b6657336b3e784a2cf8622ae97344
parentAdd new KeyFetcher impl (diff)
downloadsynapse-8c5067609cb68f2f00a4b1d9011ea278608adcd1.tar.xz
Use new KeyFetcher
-rw-r--r--synapse/crypto/keyring.py24
1 files changed, 16 insertions, 8 deletions
diff --git a/synapse/crypto/keyring.py b/synapse/crypto/keyring.py
index 278afb591f..de9a256bf9 100644
--- a/synapse/crypto/keyring.py
+++ b/synapse/crypto/keyring.py
@@ -140,14 +140,22 @@ class Keyring:
         self.clock = hs.get_clock()
 
         if key_fetchers is None:
-            key_fetchers = (
-                # Fetch keys from the database.
-                StoreKeyFetcher(hs),
-                # Fetch keys from a configured Perspectives server.
-                PerspectivesKeyFetcher(hs),
-                # Fetch keys from the origin server directly.
-                ServerKeyFetcher(hs),
-            )
+            if hs.config.worker.send_federation:
+                key_fetchers = (
+                    # Fetch keys from the database.
+                    StoreKeyFetcher(hs),
+                    # Fetch keys from a configured Perspectives server.
+                    PerspectivesKeyFetcher(hs),
+                    # Fetch keys from the origin server directly.
+                    ServerKeyFetcher(hs),
+                )
+            else:
+                key_fetchers = (
+                    # Fetch keys from the database.
+                    StoreKeyFetcher(hs),
+                    # Ask a federation sender to fetch the keys for us.
+                    InternalWorkerRequestKeyFetcher(hs),
+                )
         self._key_fetchers = key_fetchers
 
         self._fetch_keys_queue: BatchingQueue[