diff options
author | reivilibre <oliverw@matrix.org> | 2022-08-31 11:16:05 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-31 11:16:05 +0000 |
commit | 7bc110a19e6de0572b0c9513726d13298b45ced2 (patch) | |
tree | 98eb1a5b1f616c057508b1dcae61b0c8b3954dfd /synapse/federation | |
parent | Fix admin List Room API return type on sqlite (#13509) (diff) | |
download | synapse-7bc110a19e6de0572b0c9513726d13298b45ced2.tar.xz |
Generalise the `@cancellable` annotation so it can be used on functions other than just servlet methods. (#13662)
Diffstat (limited to 'synapse/federation')
-rw-r--r-- | synapse/federation/transport/server/_base.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/synapse/federation/transport/server/_base.py b/synapse/federation/transport/server/_base.py index bb0f8d6b7b..1db8009d6c 100644 --- a/synapse/federation/transport/server/_base.py +++ b/synapse/federation/transport/server/_base.py @@ -21,7 +21,7 @@ from typing import TYPE_CHECKING, Any, Awaitable, Callable, Dict, Optional, Tupl from synapse.api.errors import Codes, FederationDeniedError, SynapseError from synapse.api.urls import FEDERATION_V1_PREFIX -from synapse.http.server import HttpServer, ServletCallback, is_method_cancellable +from synapse.http.server import HttpServer, ServletCallback from synapse.http.servlet import parse_json_object_from_request from synapse.http.site import SynapseRequest from synapse.logging.context import run_in_background @@ -34,6 +34,7 @@ from synapse.logging.opentracing import ( whitelisted_homeserver, ) from synapse.types import JsonDict +from synapse.util.cancellation import is_function_cancellable from synapse.util.ratelimitutils import FederationRateLimiter from synapse.util.stringutils import parse_and_validate_server_name @@ -375,7 +376,7 @@ class BaseFederationServlet: if code is None: continue - if is_method_cancellable(code): + if is_function_cancellable(code): # The wrapper added by `self._wrap` will inherit the cancellable flag, # but the wrapper itself does not support cancellation yet. # Once resolved, the cancellation tests in |