summary refs log tree commit diff
path: root/synapse/http
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-08-19 18:40:31 +0100
committerErik Johnston <erik@matrix.org>2016-08-19 18:40:31 +0100
commit6d1a94d218cca7a039e77318951833c9e45dc043 (patch)
treefe8c0c36b676b25e8851de80ae6daa2a0c9e755f /synapse/http
parentOnly abort Measure on Exceptions (diff)
downloadsynapse-6d1a94d218cca7a039e77318951833c9e45dc043.tar.xz
Remove redundant measure
Diffstat (limited to 'synapse/http')
-rw-r--r--synapse/http/server.py69
1 files changed, 34 insertions, 35 deletions
diff --git a/synapse/http/server.py b/synapse/http/server.py
index f3357d2ff7..74840de55c 100644
--- a/synapse/http/server.py
+++ b/synapse/http/server.py
@@ -235,42 +235,41 @@ class JsonResource(HttpServer, resource.Resource):
         request_metrics = RequestMetrics()
         request_metrics.start(self.clock)
 
-        with Measure(self.clock, "http.render"):
-            # Loop through all the registered callbacks to check if the method
-            # and path regex match
-            for path_entry in self.path_regexs.get(request.method, []):
-                m = path_entry.pattern.match(request.path)
-                if not m:
-                    continue
-
-                # We found a match! Trigger callback and then return the
-                # returned response. We pass both the request and any
-                # matched groups from the regex to the callback.
-
-                callback = path_entry.callback
-
-                servlet_instance = getattr(callback, "__self__", None)
-                if servlet_instance is not None:
-                    servlet_classname = servlet_instance.__class__.__name__
-                else:
-                    servlet_classname = "%r" % callback
-
-                kwargs = intern_dict({
-                    name: urllib.unquote(value).decode("UTF-8") if value else value
-                    for name, value in m.groupdict().items()
-                })
-
-                callback_return = yield callback(request, **kwargs)
-                if callback_return is not None:
-                    code, response = callback_return
-                    self._send_response(request, code, response)
+        # Loop through all the registered callbacks to check if the method
+        # and path regex match
+        for path_entry in self.path_regexs.get(request.method, []):
+            m = path_entry.pattern.match(request.path)
+            if not m:
+                continue
+
+            # We found a match! Trigger callback and then return the
+            # returned response. We pass both the request and any
+            # matched groups from the regex to the callback.
+
+            callback = path_entry.callback
+
+            servlet_instance = getattr(callback, "__self__", None)
+            if servlet_instance is not None:
+                servlet_classname = servlet_instance.__class__.__name__
+            else:
+                servlet_classname = "%r" % callback
+
+            kwargs = intern_dict({
+                name: urllib.unquote(value).decode("UTF-8") if value else value
+                for name, value in m.groupdict().items()
+            })
+
+            callback_return = yield callback(request, **kwargs)
+            if callback_return is not None:
+                code, response = callback_return
+                self._send_response(request, code, response)
+
+            try:
+                request_metrics.stop(self.clock, request, servlet_classname)
+            except:
+                pass
 
-                try:
-                    request_metrics.stop(self.clock, request, servlet_classname)
-                except:
-                    pass
-
-                return
+            return
 
         # Huh. No one wanted to handle that? Fiiiiiine. Send 400.
         raise UnrecognizedRequestError()