Module: HTTPX::Plugins::Persistent::InstanceMethods

Defined in:
lib/httpx/plugins/persistent.rb,
sig/plugins/persistent.rbs

Instance Method Summary collapse

Instance Method Details

#closeObject



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/httpx/plugins/persistent.rb', line 39

def close(*)
  super

  # traverse other threads and unlink respective selector
  # WARNING: this is not thread safe, make sure that the session isn't being
  # used anymore, or all non-main threads are stopped.
  Thread.list.each do |th|
    store = thread_selector_store(th)

    next unless store && store.key?(self)

    selector = store.delete(self)

    selector_close(selector)
  end
end

#reconnectable_error?(error) ⇒ Boolean

Parameters:

  • error (StandardError)

Returns:

  • (Boolean)


58
59
60
# File 'lib/httpx/plugins/persistent.rb', line 58

def reconnectable_error?(error)
  Retries::RECONNECTABLE_ERRORS.any? { |klass| error.is_a?(klass) }
end