httpclient

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 22, 2026 License: MIT Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

func Shared() *http.Client

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

func Transport() *http.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

func WithTimeout(timeout time.Duration) *http.Client

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL