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

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

Overview

Connection mixin

Instance Method Summary collapse

Instance Method Details

#idlingObject



122
123
124
125
126
127
128
# File 'lib/httpx/plugins/tracing.rb', line 122

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



108
109
110
111
112
# File 'lib/httpx/plugins/tracing.rb', line 108

def initialize(*)
  super

  @init_time = ::Time.now.utc
end

#send(request) ⇒ Object



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

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