Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Respect the @cancellable flag for DirectServe{Html,Json}Resources
Browse files Browse the repository at this point in the history
`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>
  • Loading branch information
Sean Quah committed Apr 28, 2022
1 parent 5a9991c commit 46cdb4b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions synapse/http/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,8 @@ async def _async_render(self, request: SynapseRequest) -> Optional[Tuple[int, An

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.
Expand Down

0 comments on commit 46cdb4b

Please sign in to comment.