Module: HTTPX::Plugins::Hedging::ResponseMethods

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

Instance Method Summary collapse

Instance Method Details

#finish! ⇒ Object



195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
# File 'lib/httpx/plugins/hedging.rb', line 195

def finish!
  connection = @request.connection

  super

  return unless connection && (hedge_connection = connection.hedge_connection)

  # disconnect connection with its hedge, so that objects do not leak after
  # they're not needed.
  connection.hedge_connection = hedge_connection.hedge_connection = nil

  # remarking itself as the main connection, so that it's not discarded when
  # going back to the pool.
  connection.is_hedge_connection = false
  hedge_connection.is_hedge_connection = true
end