Sha256: b9ab724eeacd891d128c9c0d246088f1d84ff2040c302622f9c4e784313d5863

Contents?: true

Size: 635 Bytes

Versions: 11

Compression:

Stored size: 635 Bytes

Contents

module RailsPerformance
  class CurrentRequest
    attr_reader :request_id, :storage
    attr_accessor :record

    def CurrentRequest.init
      Thread.current[:rp_current_request] ||= CurrentRequest.new(SecureRandom.hex(16))
    end

    def CurrentRequest.current
      CurrentRequest.init
    end

    def CurrentRequest.cleanup
      Thread.current[:rp_current_request] = nil
    end

    def initialize(request_id)
      @request_id = request_id
      @storage    = []
      @record     = nil
    end

    def store(options = {})
      @storage << options.merge(time: Time.now.to_i)
    end

  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
rails_performance-0.9.9 lib/rails_performance/models/current_request.rb
rails_performance-0.9.8 lib/rails_performance/models/current_request.rb
rails_performance-0.9.7 lib/rails_performance/models/current_request.rb
rails_performance-0.9.6 lib/rails_performance/models/current_request.rb
rails_performance-0.9.5 lib/rails_performance/models/current_request.rb
rails_performance-0.9.4 lib/rails_performance/models/current_request.rb
rails_performance-0.9.3 lib/rails_performance/models/current_request.rb
rails_performance-0.9.2 lib/rails_performance/models/current_request.rb
rails_performance-0.9.1 lib/rails_performance/models/current_request.rb
rails_performance-0.9.0.1 lib/rails_performance/models/current_request.rb
rails_performance-0.9.0 lib/rails_performance/models/current_request.rb