diff options
Diffstat (limited to 'synapse/http')
-rw-r--r-- | synapse/http/server.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/synapse/http/server.py b/synapse/http/server.py index f6d4d8db86..756c6e1aee 100644 --- a/synapse/http/server.py +++ b/synapse/http/server.py @@ -314,6 +314,9 @@ class HttpServer(Protocol): If the regex contains groups these gets passed to the callback via an unpacked tuple. + The callback may be marked with the `@cancellable` decorator, which will + cause request processing to be cancelled when clients disconnect early. + Args: method: The HTTP method to listen to. path_patterns: The regex used to match requests. @@ -544,6 +547,8 @@ class JsonResource(DirectServeJsonResource): async def _async_render(self, request: SynapseRequest) -> Tuple[int, Any]: callback, servlet_classname, group_dict = self._get_handler_for_request(request) + request.is_render_cancellable = is_method_cancellable(callback) + # Make sure we have an appropriate name for this handler in prometheus # (rather than the default of JsonResource). request.request_metrics.name = servlet_classname |