class

YandexDisk::ConnectionPool

Inherits Reference < Object

Keeps a small set of keep-alive HTTP::Clients per host.

A single HTTP::Client cannot be shared by concurrent fibers — the requests interleave on the socket. Uploads run several fibers wide, so each one checks a connection out for the duration of its request and hands it back afterwards. Connections that raised are dropped rather than reused, since their socket state is unknown.

Constructors

new(max_idle_per_host : Int32 = 8, connect_timeout : Time::Span = 15.seconds, read_timeout : Time::Span = 300.seconds, write_timeout : Time::Span = 300.seconds)
Source

Instance methods

close
Source
with_client(uri : URI, & : HTTP::Client -> T) : T forall T

Checks a connection out for uri's host, yields it, and returns it to the pool. Transport-level failures are translated to TransportError so callers can treat them as retryable without knowing about sockets.

Source