Documentation
¶
Overview ¶
Package retryhttp provides a rate-limit-aware retrying http.RoundTripper for Git provider API clients.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Wrap ¶
func Wrap(base http.RoundTripper, opts Options) http.RoundTripper
Wrap returns a RoundTripper retrying rate-limited (429, or 403 with rate limit headers as used by GitHub) and transient (5xx on idempotent methods) failures with jittered exponential backoff. Retry-After and X-RateLimit-Reset headers are honored, capped at opts.MaxWait.
Types ¶
type Options ¶
type Options struct {
// MaxAttempts is the maximum number of attempts (initial request included).
MaxAttempts int
// MaxWait caps the wait between attempts. If a rate limit reset is
// further away than MaxWait, the transport gives up instead of blocking.
MaxWait time.Duration
// Logger is optional, used to log retries.
Logger *zap.SugaredLogger
}
Options configures the retry transport.
Click to show internal directories.
Click to hide internal directories.