Documentation
¶
Overview ¶
Package managementhttp ports upstream coding-agent utils/management-http.ts: a bounded immediate retry for idempotent management requests (tool downloads, release lookups). Agent and model requests must not use it; their semantic callers own retries.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FetchWithRetry ¶
func FetchWithRetry(client *http.Client, req *http.Request, options FetchRetryOptions) (*http.Response, error)
FetchWithRetry mirrors upstream fetchWithRetry. It sends req (which must be safe to resend: bodiless, or with GetBody) up to 1+MaxRetries times, retrying transport failures and, unless disabled, retryable statuses, with no delay. Caller cancellation and the overall Timeout are terminal; an AttemptTimeout expiry is retried. The returned response body keeps the attempt's deadlines until it is closed.
Types ¶
type FetchRetryOptions ¶
type FetchRetryOptions struct {
// MaxRetries is the number of additional attempts after the first. Nil
// means two; negative values mean none.
MaxRetries *int
// RetryOnStatus retries transient HTTP statuses as well as transport
// failures. Nil means true.
RetryOnStatus *bool
// Timeout is the overall budget shared by every attempt. Zero means none.
Timeout time.Duration
// AttemptTimeout bounds each attempt separately, so a hung connection can
// be retried. Zero means none.
AttemptTimeout time.Duration
}
FetchRetryOptions mirrors upstream FetchRetryOptions.