Skip to content

confusion about docs/api with global timeouts #488

@jrochkind

Description

@jrochkind

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!

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