Sha256: 355d403d1413a2b623ae8d0511f53fccce1ecf357cd1da6760f1c4fc60f12c5f

Contents?: true

Size: 755 Bytes

Versions: 1

Compression:

Stored size: 755 Bytes

Contents

module RailsPerformance
  module Rails
    class Middleware
      def initialize(app)
        @app = app
      end

      def call(env)
        @status, @headers, @response = @app.call(env)

        if record = Thread.current["RP_request_info"]
          begin
            record[:status]   ||= @status
            record[:request_id] = CurrentRequest.current.request_id
            RP::Utils.log_trace_in_redis(CurrentRequest.current.request_id, CurrentRequest.current.storage)
            RP::Utils.log_request_in_redis(record)
          ensure
            Thread.current["RP_request_info"] = nil
            CurrentRequest.cleanup
          end
        end

        [@status, @headers, @response]
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rails_performance-0.0.1.19 lib/rails_performance/rails/middleware.rb