summary refs log tree commit diff
path: root/synapse/rest
diff options
context:
space:
mode:
authorAndrew Morgan <andrew@amorgan.xyz>2020-08-03 17:39:15 -0700
committerAndrew Morgan <andrew@amorgan.xyz>2020-08-03 17:39:15 -0700
commit38c605a2d3fbfe67a028c160699be183453839d6 (patch)
tree724aeec9118963969e99983dbf758d06f326dfb7 /synapse/rest
parentMerge commit 'b74919c72' into anoa/dinsic_release_1_18_x (diff)
parentSkip serializing /sync response if client has disconnected (#7927) (diff)
downloadsynapse-38c605a2d3fbfe67a028c160699be183453839d6.tar.xz
Merge commit '923c99502' into anoa/dinsic_release_1_18_x
* commit '923c99502':
  Skip serializing /sync response if client has disconnected (#7927)
Diffstat (limited to 'synapse/rest')
-rw-r--r--synapse/rest/client/v2_alpha/sync.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/synapse/rest/client/v2_alpha/sync.py b/synapse/rest/client/v2_alpha/sync.py
index 9d81150729..a5c24fbd63 100644
--- a/synapse/rest/client/v2_alpha/sync.py
+++ b/synapse/rest/client/v2_alpha/sync.py
@@ -178,6 +178,12 @@ class SyncRestServlet(RestServlet):
                 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()
         response_content = await self.encode_response(
             time_now, sync_result, requester.access_token_id, filter_collection