Skip to content

Commit

Permalink
Merge branch '1.0' of https://github.com/lostisland/faraday into feat…
Browse files Browse the repository at this point in the history
…ure/#762-rspec

# Conflicts:
#	test/adapters/net_http_persistent_test.rb
  • Loading branch information
iMacTia committed Nov 26, 2018
2 parents 8b1c857 + 5547802 commit 58a3174
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -288,7 +288,7 @@ end
### NetHttpPersistent
```ruby
conn = Faraday.new(...) do |f|
f.adapter :net_http_persistent do |http| # yields Net::HTTP::Persistent
f.adapter :net_http_persistent, pool_size: 5 do |http| # yields Net::HTTP::Persistent
http.idle_timeout = 100
http.retry_change_requests = true
end
Expand Down
4 changes: 3 additions & 1 deletion lib/faraday/adapter/net_http_persistent.rb
Expand Up @@ -9,7 +9,9 @@ class NetHttpPersistent < NetHttp
def net_http_connection(env)
@cached_connection ||=
if Net::HTTP::Persistent.instance_method(:initialize).parameters.first == [:key, :name]
Net::HTTP::Persistent.new(name: 'Faraday')
options = {name: 'Faraday'}
options[:pool_size] = @connection_options[:pool_size] if @connection_options.key?(:pool_size)
Net::HTTP::Persistent.new(options)
else
Net::HTTP::Persistent.new('Faraday')
end
Expand Down

0 comments on commit 58a3174

Please sign in to comment.