Skip to content

Commit

Permalink
Merge pull request #153 from rsolr/default-adapter
Browse files Browse the repository at this point in the history
Update Faraday HTTP client defaults
  • Loading branch information
cbeer committed Sep 29, 2016
2 parents b01528e + 65017d8 commit db23c40
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/rsolr/client.rb
Expand Up @@ -291,14 +291,15 @@ def connection
conn_opts[:proxy] = proxy if proxy
conn_opts[:request][:open_timeout] = options[:open_timeout] if options[:open_timeout]
conn_opts[:request][:timeout] = options[:read_timeout] if options[:read_timeout]
conn_opts[:request][:params_encoder] = Faraday::FlatParamsEncoder

Faraday.new(conn_opts) do |conn|
conn.basic_auth(uri.user, uri.password) if uri.user && uri.password
conn.response :raise_error
conn.request :retry, max: options[:retry_after_limit], interval: 0.05,
interval_randomness: 0.5, backoff_factor: 2,
exceptions: ['Faraday::Error', 'Timeout::Error'] if options[:retry_503]
conn.adapter options.fetch(:adapter, :net_http)
conn.adapter options[:adapter] || Faraday.default_adapter
end
end
end
Expand Down

0 comments on commit db23c40

Please sign in to comment.