Commit 27bd44a8 authored by Douwe Maan's avatar Douwe Maan

Merge branch 'fix/request-profiler-error-when-unauthenticated' into 'master'

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

## What does this MR do?
It fixes the error thrown when profiling a request unauthorized.

## Are there points in the code the reviewer needs to double check?
N/A

## Why was this MR needed?
It's a bug! :)

## What are the relevant issue numbers?
#20488

## Screenshots (if relevant)
N/A

## Does this MR meet the acceptance criteria?

- [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added
- [ ] ~~[Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md)~~
- [ ] ~~API support added~~
- ~~Tests~~
  - [ ] ~~Added for this feature/bug~~
  - [ ] ~~All builds are passing~~
- [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)
- [x] Branch has no merge conflicts with `master` (if you do - rebase it please)
- [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)

See merge request !5596
parents 0819461e 0720b9ce
......@@ -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
......
......@@ -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
if ret.is_a?(Array)
ret
else
throw(:warden, ret)
end
end
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment