Azure / azure-ruby-asm-core

Azure Ruby SDK Service Management Core HTTP
6 stars 32 forks source link

Faraday's `open_timeout` not configurable and defaults to 60 seconds! #30

Open andrewferk opened 7 years ago

andrewferk commented 7 years ago

If for any reason the Azure Storage service cannot be reached, the Faraday client will not timeout until after 60 seconds and this is not configurable.

open_timeout is set in azure-ruby-asm-core, and I don't know of I way to have it already set. I would prefer this to be defined by an environment variable.

It looks like it was addressed in April, but for some reason it was decided 60 seconds was a good timeout value.

sarangan12 commented 7 years ago

@yaxia Can you take a look at this issue and share your thoughts about making this value configurable?

yaxia commented 7 years ago

The value is configurable from the option parameter when creates the Faraday object. In my opinion, either read the value from an option or an environment variable is OK. But this should be the call of the implementation of the HTTP client.

Since the open_timeout is more like a per connection setting instead of a global setting from a library's perspective, I'd prefer keep the current implementation and leave the flexibility to the user to decide how the client will provide the connection options, setting from code or reading from environment variables. As a reference, the Azure Storage client implements its own way of creating a Faraday object, by reading the CA file path from code and proxy settings from the environment variables.

BTW, the default value of 60 seconds is from the Ruby implementation, NET::Http, open_tiumeout attribute.

+@veronicagg for more comment.

veronicagg commented 7 years ago

I agree that we're currently not providing a way to configure open_timeout. We're not planning to address this issue soon though, we'd be happy to review a PR if one is submitted.