-
Notifications
You must be signed in to change notification settings - Fork 328
Description
The wiki page on Timeouts suggests:
Global timeouts let you set an upper bound of how long a request can take, without having to rely on Timeout.timeout:
HTTP.timeout(:global, :write => 1, :connect => 1, :read => 1) .get "http://example.com"Uses a timeout of 3 seconds, for the entire get call.
This sounds just right -- avoiding Timeout.timeout is always great for well-known reasons, and my use cases want a timeout for the entire get call, I don't care how long connect/write/read individually take, I just care that the end-to-end time times out after N seconds.
But I don't understand these docs. If it's a timeout for the "entire get call", why am i providing write/connect/read separately? In the above example, if the connect takes more than one second... will it timeout? Even though it hasn't reached the "3 seconds, for the entire get call"? Or are the individual numbers ignored, and just summed up, as "Uses a timeout of 3 seconds, for the entire get call" suggests? But then how does that API make any sense?
With the description of what it does, I would have expected an API more like HTTP.timeout(global: 3).
What's going on here? Can you advise? Thanks!