Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
tornado: Ignore StreamClosedError.
Anders Kaseorg4fc3845dc253
diff --git a/zerver/tornado/handlers.py b/zerver/tornado/handlers.pyindex 194b912794a..5a94daec10a 100644--- a/zerver/tornado/handlers.py+++ b/zerver/tornado/handlers.py@@ -11,6 +11,7 @@ from django.core.handlers.wsgi import WSGIRequest, get_script_namefrom django.http import HttpRequest, HttpResponsefrom django.urls import set_script_prefixfrom django.utils.cache import patch_vary_headers+from tornado.iostream import StreamClosedErrorfrom tornado.wsgi import WSGIContainerfrom zerver.lib.response import AsynchronousResponse, json_response@@ -146,7 +147,12 @@ class AsyncDjangoHandler(tornado.web.RequestHandler, base.BaseHandler):self.write(response.content)# Close the connection.- await self.finish()+ try:+ await self.finish()+ except StreamClosedError:+ # While writing the response, we might realize that the+ # user already closed the connection; that is fine.+ passasync def get(self, *args: Any, **kwargs: Any) -> None:request = await self.convert_tornado_request_to_django_request()