Skip to content

idea: global timeout settings #176

Closed
@jjb

Description

@jjb

faraday allows setting global timeouts

Faraday.default_connection_options = Faraday::ConnectionOptions.new({
  open_timeout: ENV.fetch('NET_HTTP_OPEN_TIMEOUT', 5).to_f,
  timeout: ENV.fetch('NET_HTTP_TIMEOUT', 30).to_f
})

If i set this, then i know all my own code which uses faraday, and gems that i use which use faraday (and don't set their own timeouts, which seems to usually be the case), will have this timeout set.

for net-http, i can do some combination of the bellow:

a) set it one by one for my own code
b) ask gem authors to allow this to be configured when it's not
c) monkeypatch gems
d) do a global monkeypatch of net-http
e) use the http-cage gem which has't been updated in 3 years (but maybe doesn't need to be, haven't really checked)

it would be great if net-http allowed a global setting, similar to faraday

i would be happy to submit a PR if folks think it's a good idea

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions