Documentation
¶
Overview ¶
Package retry decorates an inference.Client with bounded, classified retry and exponential backoff. It retries Invoke calls and Stream establishment only; once a StreamReader is handed out, a mid-stream failure is terminal for the wrapper exactly as for the inner client.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Retryable ¶
Retryable reports whether err is worth another attempt: a transient transport/network failure or a provider status that signals pressure (408, 429, 5xx). Context cancellation is never retryable, even when it wraps a retryable cause. Exported so other callers (hustleruntime holds a private copy of this predicate today) can converge on one definition.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client decorates an inner inference.Client with the Policy's schedule.
type ConfigError ¶
ConfigError reports an invalid retry configuration at construction.
func (*ConfigError) Error ¶
func (e *ConfigError) Error() string
type ExhaustedError ¶
ExhaustedError reports that every permitted attempt failed. Unwrap exposes the final attempt's failure so typed inspection (errors.As on *failure.APIError / *failure.NetworkError) keeps working.
func (*ExhaustedError) Error ¶
func (e *ExhaustedError) Error() string
func (*ExhaustedError) Unwrap ¶
func (e *ExhaustedError) Unwrap() error
type InvalidResponseError ¶
type InvalidResponseError struct{}
InvalidResponseError reports an inner client that returned no response and no error. A retry decorator cannot classify or replay this malformed result.
func (*InvalidResponseError) Error ¶
func (*InvalidResponseError) Error() string
type Policy ¶
type Policy struct {
StableRetries int // retries at fixed StableDelay
StableDelay time.Duration // delay for the stable retry leg
MaxAttempts int // total attempts including the first
MaxDelay time.Duration // cap on the exponential retry leg
}
Policy is the immutable retry schedule: StableRetries retries at StableDelay, then exponential doubling (starting at 2*StableDelay) capped at MaxDelay, until MaxAttempts total attempts have been made.