summary refs log tree commit diff
path: root/synapse/http/server.py
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2018-01-17 14:01:57 +0000
committerRichard van der Hoff <richard@matrix.org>2018-01-17 14:01:57 +0000
commite8f7541d3fbff2fc1b0eda369f44c8a4a6d42800 (patch)
treeebca667ed4a315eb70c9e760b5f49cea95039cd6 /synapse/http/server.py
parentTrack DB scheduling delay per-request (diff)
parentMerge pull request #2793 from matrix-org/rav/db_txn_time_in_millis (diff)
downloadsynapse-e8f7541d3fbff2fc1b0eda369f44c8a4a6d42800.tar.xz
Merge remote-tracking branch 'origin/develop' into rav/track_db_scheduling
Diffstat (limited to 'synapse/http/server.py')
-rw-r--r--synapse/http/server.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/synapse/http/server.py b/synapse/http/server.py
index 7b6418bc2c..165c684d0d 100644
--- a/synapse/http/server.py
+++ b/synapse/http/server.py
@@ -322,15 +322,6 @@ class JsonResource(HttpServer, resource.Resource):
 
     def _send_response(self, request, code, response_json_object,
                        response_code_message=None):
-        # could alternatively use request.notifyFinish() and flip a flag when
-        # the Deferred fires, but since the flag is RIGHT THERE it seems like
-        # a waste.
-        if request._disconnected:
-            logger.warn(
-                "Not sending response to request %s, already disconnected.",
-                request)
-            return
-
         outgoing_responses_counter.inc(request.method, str(code))
 
         # TODO: Only enable CORS for the requests that need it.
@@ -409,6 +400,15 @@ class RootRedirect(resource.Resource):
 def respond_with_json(request, code, json_object, send_cors=False,
                       response_code_message=None, pretty_print=False,
                       version_string="", canonical_json=True):
+    # could alternatively use request.notifyFinish() and flip a flag when
+    # the Deferred fires, but since the flag is RIGHT THERE it seems like
+    # a waste.
+    if request._disconnected:
+        logger.warn(
+            "Not sending response to request %s, already disconnected.",
+            request)
+        return
+
     if pretty_print:
         json_bytes = encode_pretty_printed_json(json_object) + "\n"
     else: