Catch what warden might throw when profiling requests to re-throw it

Closes #20488
This commit is contained in:
Ahmad Sherif 2016-08-01 16:55:50 +02:00
parent 0819461e84
commit 0720b9ce00
2 changed files with 9 additions and 2 deletions

View File

@ -44,6 +44,7 @@ v 8.11.0 (unreleased)
- Reduce number of queries made for merge_requests/:id/diffs
- Sensible state specific default sort order for issues and merge requests !5453 (tomb0y)
- Fix RequestProfiler::Middleware error when code is reloaded in development
- Catch what warden might throw when profiling requests to re-throw it
v 8.10.3 (unreleased)
- Fix importer for GitHub Pull Requests when a branch was removed

View File

@ -29,7 +29,9 @@ module Gitlab
def call_with_profiling(env)
ret = nil
result = RubyProf::Profile.profile do
ret = @app.call(env)
ret = catch(:warden) do
@app.call(env)
end
end
printer = RubyProf::CallStackPrinter.new(result)
@ -41,7 +43,11 @@ module Gitlab
printer.print(file)
end
ret
if ret.is_a?(Array)
ret
else
throw(:warden, ret)
end
end
end
end