forked from MirrorHub/synapse
Skip serializing /sync response if client has disconnected (#7927)
... it's a load of work which may be entirely redundant.
This commit is contained in:
parent
b74919c72e
commit
923c995023
2 changed files with 7 additions and 0 deletions
1
changelog.d/7927.misc
Normal file
1
changelog.d/7927.misc
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Optimisation to /sync handling: skip serializing the response if the client has already disconnected.
|
|
@ -178,6 +178,12 @@ class SyncRestServlet(RestServlet):
|
||||||
full_state=full_state,
|
full_state=full_state,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# 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, {}
|
||||||
|
|
||||||
time_now = self.clock.time_msec()
|
time_now = self.clock.time_msec()
|
||||||
response_content = await self.encode_response(
|
response_content = await self.encode_response(
|
||||||
time_now, sync_result, requester.access_token_id, filter_collection
|
time_now, sync_result, requester.access_token_id, filter_collection
|
||||||
|
|
Loading…
Reference in a new issue