Documentation
¶
Overview ¶
Package httpclient owns the HTTP client that model adapters use when their caller supplies none.
It exists because http.DefaultTransport is the wrong default for this system. Its MaxIdleConnsPerHost is 2, which is a sensible number for a program that talks to many hosts occasionally and the wrong one for a realtime runtime, which talks to a handful of hosts constantly: a recogniser is called several times a second per session, and every concurrent call past the second returns a connection that is closed rather than pooled. The next call redials and renegotiates TLS, on the path a person is waiting on.
The repository already knew this. The offline review client tunes its own transport; the adapters that serve live conversations did not, which is the wrong way round.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Shared ¶
Shared returns the process-wide adapter HTTP client.
It carries no Timeout. A single deadline for every provider is the mistake that hides a stalled one: a recogniser answering in tens of milliseconds and a reasoner answering in tens of seconds cannot share a bound that is meaningful for either. Adapters put a deadline on each request from their own cadence, which is where the knowledge is.
func Transport ¶
Transport returns a new transport with the same settings, for a caller that needs its own pool - a credential boundary, a proxy, a test that counts connections.
func WithTimeout ¶
WithTimeout returns a client that shares the process-wide connection pool and carries one whole-request deadline.
It is for the callers that already had a client-level timeout of their own, derived from what that particular service is expected to take. Sharing the pool is the point: a per-caller client would be a per-caller pool, and the reuse this package exists for would stop at the first one.
Types ¶
This section is empty.