Class: Faraday::Adapter::SemaphoreNetHttp

Inherits:
NetHttp
  • Object
show all
Defined in:
lib/ext/faraday.rb

Instance Method Summary collapse

Instance Method Details

#net_http_connection(env) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/ext/faraday.rb', line 4

def net_http_connection(env)
  connections = (Thread.current[:net_http_connections] ||= {})
  env_key = [env.url.host, env.url.port, env.ssl.verify]
  connections[env_key] ||= begin
                             super(env).tap { |connection|
                               # uncomment to enable Net::HTTP debugging
                               # connection.set_debug_output($stderr)
                               connection.use_ssl = true
                               connection.start
                             }
                           end
end