Module: HTTPX::Plugins::Tracing::ConnectionMethods

Defined in:
lib/httpx/plugins/tracing.rb

Overview

Connection mixin

Instance Method Summary collapse

Instance Method Details

#idlingObject



127
128
129
130
131
132
133
# File 'lib/httpx/plugins/tracing.rb', line 127

def idling
  super

  # time of initial request(s) is accounted from the moment
  # the connection is back to :idle, and ready to connect again.
  @init_time = ::Time.now.utc
end

#initializeObject



113
114
115
116
117
# File 'lib/httpx/plugins/tracing.rb', line 113

def initialize(*)
  super

  @init_time = ::Time.now.utc
end

#send(request) ⇒ Object



119
120
121
122
123
124
125
# File 'lib/httpx/plugins/tracing.rb', line 119

def send(request)
  # request init time is only the same as the connection init time
  # if the connection is going through the connection handshake.
  request.init_time ||= @init_time unless open?

  super
end