mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-12-18 02:54:19 -05:00
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
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 New Issue
Block a user