Welcome to mirror list, hosted at ThFree Co, Russian Federation.

peek_performance_bar_with_rack_body.rb « performance_bar « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d939a6ea18d73c28b233a650fe625198e9d4e49f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# This solves a bug with a X-Senfile header that wouldn't be set properly, see
# https://github.com/peek/peek-performance_bar/pull/27
module Gitlab
  module PerformanceBar
    module PeekPerformanceBarWithRackBody
      def call(env)
        @env = env
        reset_stats

        @total_requests += 1
        first_request if @total_requests == 1

        env['process.request_start'] = @start.to_f
        env['process.total_requests'] = total_requests

        status, headers, body = @app.call(env)
        body = Rack::BodyProxy.new(body) { record_request }
        [status, headers, body]
      end
    end
  end
end