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

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

Instance Method Summary collapse

Instance Method Details

#close ⇒ Object



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/httpx/plugins/persistent.rb', line 45

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