Sha256: 7b3d1cecc32ad8a411e0c32f3751edb678010f6012f1b018824b92daae95a5d3

Contents?: true

Size: 837 Bytes

Versions: 7

Compression:

Stored size: 837 Bytes

Contents

module RailsPerformance
  class CurrentRequest
    attr_reader :request_id, :tracings, :ignore
    attr_accessor :data
    attr_accessor :record

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

    def self.current
      CurrentRequest.init
    end

    def self.cleanup
      RailsPerformance.log "----------------------------------------------------> CurrentRequest.cleanup !!!!!!!!!!!! -------------------------\n\n"
      RailsPerformance.skip = false
      Thread.current[:rp_current_request] = nil
    end

    def initialize(request_id)
      @request_id = request_id
      @tracings = []
      @ignore = Set.new
      @data = nil
      @record = nil
    end

    def trace(options = {})
      @tracings << options.merge(time: Time.current.to_i)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rails_performance-1.4.0.alpha3 lib/rails_performance/thread/current_request.rb
rails_performance-1.4.0.alpha2 lib/rails_performance/thread/current_request.rb
rails_performance-1.4.0.alpha1 lib/rails_performance/thread/current_request.rb
rails_performance-1.3.3 lib/rails_performance/thread/current_request.rb
rails_performance-1.3.2 lib/rails_performance/thread/current_request.rb
rails_performance-1.3.1 lib/rails_performance/thread/current_request.rb
rails_performance-1.3.0 lib/rails_performance/thread/current_request.rb