Avoid serializing response that will never be heard

This commit is contained in:
Eric Eastwood 2024-06-03 20:13:00 -05:00
parent 1268a5413f
commit e4c66b8ac9

View file

@ -914,6 +914,12 @@ class SlidingSyncRestServlet(RestServlet):
timeout, timeout,
) )
# The client may have disconnected by now; don't bother to serialize the
# response if so.
if request._disconnected:
logger.info("Client has disconnected; not serializing response.")
return 200, {}
response_content = await self.encode_response(sliding_sync_results) response_content = await self.encode_response(sliding_sync_results)
return 200, response_content return 200, response_content