summary refs log tree commit diff
path: root/synapse/api
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/api
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/api')
-rw-r--r--synapse/api/auth.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/synapse/api/auth.py b/synapse/api/auth.py
index 9a1aea083f..8e54ef84b2 100644
--- a/synapse/api/auth.py
+++ b/synapse/api/auth.py
@@ -38,6 +38,7 @@ from synapse.logging.opentracing import (
     trace,
 )
 from synapse.types import Requester, create_requester
+from synapse.util.cancellation import cancellable
 
 if TYPE_CHECKING:
     from synapse.server import HomeServer
@@ -118,6 +119,7 @@ class Auth:
             errcode=Codes.NOT_JOINED,
         )
 
+    @cancellable
     async def get_user_by_req(
         self,
         request: SynapseRequest,
@@ -166,6 +168,7 @@ class Auth:
                     parent_span.set_tag("appservice_id", requester.app_service.id)
             return requester
 
+    @cancellable
     async def _wrapped_get_user_by_req(
         self,
         request: SynapseRequest,
@@ -281,6 +284,7 @@ class Auth:
                 403, "Application service has not registered this user (%s)" % user_id
             )
 
+    @cancellable
     async def _get_appservice_user(self, request: Request) -> Optional[Requester]:
         """
         Given a request, reads the request parameters to determine:
@@ -523,6 +527,7 @@ class Auth:
         return bool(query_params) or bool(auth_headers)
 
     @staticmethod
+    @cancellable
     def get_access_token_from_request(request: Request) -> str:
         """Extracts the access_token from the request.