summary refs log tree commit diff
path: root/synapse/rest/client
diff options
context:
space:
mode:
authorreivilibre <oliverw@matrix.org>2022-09-07 11:03:32 +0000
committerGitHub <noreply@github.com>2022-09-07 12:03:32 +0100
commitd3d9ca156e323fe194b1bcb1af1628f65a2f3c1c (patch)
tree74e19b799192c8be69179e27ceadda7a8beac18c /synapse/rest/client
parentRename the `EventFormatVersions` enum values so that they line up with room v... (diff)
downloadsynapse-d3d9ca156e323fe194b1bcb1af1628f65a2f3c1c.tar.xz
Cancel the processing of key query requests when they time out. (#13680)
Diffstat (limited to 'synapse/rest/client')
-rw-r--r--synapse/rest/client/keys.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/synapse/rest/client/keys.py b/synapse/rest/client/keys.py
index a395694fa5..f653d2a3e1 100644
--- a/synapse/rest/client/keys.py
+++ b/synapse/rest/client/keys.py
@@ -27,9 +27,9 @@ from synapse.http.servlet import (
 )
 from synapse.http.site import SynapseRequest
 from synapse.logging.opentracing import log_kv, set_tag
+from synapse.rest.client._base import client_patterns, interactive_auth_handler
 from synapse.types import JsonDict, StreamToken
-
-from ._base import client_patterns, interactive_auth_handler
+from synapse.util.cancellation import cancellable
 
 if TYPE_CHECKING:
     from synapse.server import HomeServer
@@ -156,6 +156,7 @@ class KeyQueryServlet(RestServlet):
         self.auth = hs.get_auth()
         self.e2e_keys_handler = hs.get_e2e_keys_handler()
 
+    @cancellable
     async def on_POST(self, request: SynapseRequest) -> Tuple[int, JsonDict]:
         requester = await self.auth.get_user_by_req(request, allow_guest=True)
         user_id = requester.user.to_string()
@@ -199,6 +200,7 @@ class KeyChangesServlet(RestServlet):
         self.device_handler = hs.get_device_handler()
         self.store = hs.get_datastores().main
 
+    @cancellable
     async def on_GET(self, request: SynapseRequest) -> Tuple[int, JsonDict]:
         requester = await self.auth.get_user_by_req(request, allow_guest=True)