irb(main):014:1* client = Faraday.new('https://rubygems.org') do |config|
irb(main):015:1* config.use FaradayMiddleware::FollowRedirects
irb(main):016:1* config.adapter :net_http
irb(main):017:1* config.options.timeout = 10 # what we're using for the configurable :fetch_timeout
irb(main):018:0> end
=>
#<Faraday::Connection:0x0000007fa2fb2f80
...
Would the gemstash project be up for the open_timeout becoming configurable like the fetch timeout? I'm happy to start a PR.
… with some guidance on the nuances of the implementation. For my temporary hack, I first attempted to naively reuse :fetch_timeout and it became clear that the gemstash_env utility is currently only mixed in as a class method (extend Gemstash::Env::Helper), not instance (include Gemstash::Env::Helper). If this open_timeout becomes configurable, I don't know if you would prefer mixing in as instance methods, too, or passing the timeout as a new parameter to HTTPClient.new(), or some other means I haven't thought of.
Okay, here's the situation.
We're using gemstash to reduce the load on sparse internet this weekend at Ruby for Good. Our internet connection has some pretty high latency. gemstash's missing-in-cache-so-fetch-it activity would often run afoul of the 2-second hard-coded timeout for gemstash to open a connection to the configured upstream.
My parents went away on a week's vacation.
I whittled the replication case down to the following run while on our sparse internet connection:
Just enough HTTPClient.for() …
Just enough client.get() …
They left the keys to the brand new Porsche
So, I've forked and hard-coded a larger timeout for the moment.
Would they mind?
Would the gemstash project be up for the open_timeout becoming configurable like the fetch timeout? I'm happy to start a PR.
… with some guidance on the nuances of the implementation. For my temporary hack, I first attempted to naively reuse
:fetch_timeout
and it became clear that thegemstash_env
utility is currently only mixed in as a class method (extend Gemstash::Env::Helper
), not instance (include Gemstash::Env::Helper
). If this open_timeout becomes configurable, I don't know if you would prefer mixing in as instance methods, too, or passing the timeout as a new parameter to HTTPClient.new(), or some other means I haven't thought of.