retryhttp

package
v0.51.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

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.

Jump to

Keyboard shortcuts

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