Documentation
¶
Overview ¶
Package retry provides explicit opt-in HTTP retry transports for providers.
The default SDK behavior is no retry. Provider configs expose Retry for the simple path; this package is also available for advanced transport composition.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewHTTPClient ¶
NewHTTPClient returns a shallow copy of base whose Transport is wrapped by NewTransport. Provider Config.Retry is the preferred user-facing API.
func NewTransport ¶
func NewTransport(base http.RoundTripper, policy *Policy) http.RoundTripper
NewTransport wraps base with retry behavior. A nil policy, MaxAttempts <= 1, or nil base keeps behavior simple: no retry or http.DefaultTransport.
Types ¶
type Policy ¶
type Policy struct {
MaxAttempts int
InitialDelay time.Duration
MaxDelay time.Duration
Multiplier float64
Jitter bool
RespectRetryAfter bool
}
func DefaultPolicy ¶
func DefaultPolicy() *Policy
DefaultPolicy returns a conservative retry policy for complete retryable HTTP responses. It does not retry network write/read errors because a POST may already have been processed by the provider.
type Transport ¶
type Transport struct {
Base http.RoundTripper
Policy Policy
}
Transport retries complete 429/5xx/529 responses according to Policy. It requires replayable request bodies for retries.