Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to configure net http persistent client #262

Closed
ajsharp opened this issue Apr 30, 2013 · 5 comments
Closed

Ability to configure net http persistent client #262

ajsharp opened this issue Apr 30, 2013 · 5 comments

Comments

@ajsharp
Copy link
Contributor

ajsharp commented Apr 30, 2013

Currently, it's not possibly through the api to configure the idle_timeout, because the faraday net http persistent adapter instantiates a new Net::HTTP::Persistent instance on each request. The library is smart enough to use the same connection across instances for performing http requests, but it configuration options such as idle_timeout must be configured on a per-object basis. Has this been an issue with other adapters, that needed custom configuration passed to it? Thanks.

@mislav
Copy link
Contributor

mislav commented May 3, 2013

👍

I'd like to have the ability to configure the connection as well. Not necessarily through request options in env, but at adapter instantiation time. Maybe via a configuration block?

conn.adapter :net_http_persistent do |http|
  http.stuff = :moo
end

@ajsharp
Copy link
Contributor Author

ajsharp commented May 3, 2013

Ooh yea, I like the block configuration interface.

@rehevkor5
Copy link

I am encountering similar difficulties as I'm attempting to implement an adapter for Excon that enables persistent connections. If the adapter re-uses the same Excon object multiple times, then it is difficult to ensure that new settings on the individual request take effect on the Excon object. If I make the adapter create a new object each time, then as you mention the initial settings must be given to the object each time. The behavior of Faraday vs. the adapter in terms of globally configured settings vs. per-request settings (some of them probably can't be per-request) seems a bit unclear to me.

@justinvj15
Copy link

👍

Is this implemented ?

Thanks

@iMacTia
Copy link
Member

iMacTia commented Feb 9, 2017

This is now implemented and released as of v0.11.0 😃
See https://github.com/lostisland/faraday#ad-hoc-adapters-customization for details

@iMacTia iMacTia closed this as completed Feb 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants