mirror of https://github.com/zulip/zulip.git
profile_request: Support only synchronous responses for now.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
ff6cf54716
commit
32a8151ce8
|
@ -27,6 +27,7 @@ def profile_request(request: HttpRequest) -> HttpResponseBase:
|
||||||
prof = cProfile.Profile()
|
prof = cProfile.Profile()
|
||||||
with tempfile.NamedTemporaryFile(prefix="profile.data.", delete=False) as stats_file:
|
with tempfile.NamedTemporaryFile(prefix="profile.data.", delete=False) as stats_file:
|
||||||
response = LogRequests(get_response)(request)
|
response = LogRequests(get_response)(request)
|
||||||
|
assert isinstance(response, HttpResponseBase) # async responses not supported here for now
|
||||||
prof.dump_stats(stats_file.name)
|
prof.dump_stats(stats_file.name)
|
||||||
logging.info("Profiling data written to %s", stats_file.name)
|
logging.info("Profiling data written to %s", stats_file.name)
|
||||||
return response
|
return response
|
||||||
|
|
Loading…
Reference in New Issue