summary refs log tree commit diff
path: root/synapse/http
diff options
context:
space:
mode:
authorSean Quah <8349537+squahtx@users.noreply.github.com>2022-05-11 12:24:48 +0100
committerGitHub <noreply@github.com>2022-05-11 12:24:48 +0100
commitdffecade7df8a88caced2a7707c51e2de3407c0d (patch)
tree9fdd73267703745b47efbb237b282545e10e1927 /synapse/http
parentRemove unneeded `ActionGenerator` class. (#12691) (diff)
downloadsynapse-dffecade7df8a88caced2a7707c51e2de3407c0d.tar.xz
Respect the `@cancellable` flag for `DirectServe{Html,Json}Resource`s (#12698)
`DirectServeHtmlResource` and `DirectServeJsonResource` both inherit
from `_AsyncResource`. These classes expect to be subclassed with
`_async_render_*` methods.

This commit has no effect on `JsonResource`, despite inheriting from
`_AsyncResource`. `JsonResource` has its own `_async_render` override
which will need to be updated separately.

Signed-off-by: Sean Quah <seanq@element.io>
Diffstat (limited to 'synapse/http')
-rw-r--r--synapse/http/server.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/synapse/http/server.py b/synapse/http/server.py
index 4b4debc5cd..f6d4d8db86 100644
--- a/synapse/http/server.py
+++ b/synapse/http/server.py
@@ -382,6 +382,8 @@ class _AsyncResource(resource.Resource, metaclass=abc.ABCMeta):
 
         method_handler = getattr(self, "_async_render_%s" % (request_method,), None)
         if method_handler:
+            request.is_render_cancellable = is_method_cancellable(method_handler)
+
             raw_callback_return = method_handler(request)
 
             # Is it synchronous? We'll allow this for now.