mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-03 02:54:52 -04:00
Remove redundant measure
This commit is contained in:
parent
8731197e54
commit
6d1a94d218
1 changed files with 28 additions and 29 deletions
|
@ -235,42 +235,41 @@ class JsonResource(HttpServer, resource.Resource):
|
||||||
request_metrics = RequestMetrics()
|
request_metrics = RequestMetrics()
|
||||||
request_metrics.start(self.clock)
|
request_metrics.start(self.clock)
|
||||||
|
|
||||||
with Measure(self.clock, "http.render"):
|
# Loop through all the registered callbacks to check if the method
|
||||||
# Loop through all the registered callbacks to check if the method
|
# and path regex match
|
||||||
# and path regex match
|
for path_entry in self.path_regexs.get(request.method, []):
|
||||||
for path_entry in self.path_regexs.get(request.method, []):
|
m = path_entry.pattern.match(request.path)
|
||||||
m = path_entry.pattern.match(request.path)
|
if not m:
|
||||||
if not m:
|
continue
|
||||||
continue
|
|
||||||
|
|
||||||
# We found a match! Trigger callback and then return the
|
# We found a match! Trigger callback and then return the
|
||||||
# returned response. We pass both the request and any
|
# returned response. We pass both the request and any
|
||||||
# matched groups from the regex to the callback.
|
# matched groups from the regex to the callback.
|
||||||
|
|
||||||
callback = path_entry.callback
|
callback = path_entry.callback
|
||||||
|
|
||||||
servlet_instance = getattr(callback, "__self__", None)
|
servlet_instance = getattr(callback, "__self__", None)
|
||||||
if servlet_instance is not None:
|
if servlet_instance is not None:
|
||||||
servlet_classname = servlet_instance.__class__.__name__
|
servlet_classname = servlet_instance.__class__.__name__
|
||||||
else:
|
else:
|
||||||
servlet_classname = "%r" % callback
|
servlet_classname = "%r" % callback
|
||||||
|
|
||||||
kwargs = intern_dict({
|
kwargs = intern_dict({
|
||||||
name: urllib.unquote(value).decode("UTF-8") if value else value
|
name: urllib.unquote(value).decode("UTF-8") if value else value
|
||||||
for name, value in m.groupdict().items()
|
for name, value in m.groupdict().items()
|
||||||
})
|
})
|
||||||
|
|
||||||
callback_return = yield callback(request, **kwargs)
|
callback_return = yield callback(request, **kwargs)
|
||||||
if callback_return is not None:
|
if callback_return is not None:
|
||||||
code, response = callback_return
|
code, response = callback_return
|
||||||
self._send_response(request, code, response)
|
self._send_response(request, code, response)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
request_metrics.stop(self.clock, request, servlet_classname)
|
request_metrics.stop(self.clock, request, servlet_classname)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
# Huh. No one wanted to handle that? Fiiiiiine. Send 400.
|
# Huh. No one wanted to handle that? Fiiiiiine. Send 400.
|
||||||
raise UnrecognizedRequestError()
|
raise UnrecognizedRequestError()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue