Help us shape the future of Go! Take the 2026 Go Developer Survey

retryhandler

package
v0.34.1 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: Apache-2.0 Imports: 11 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MaxRetryBackoff = 8 * time.Second

MaxRetryBackoff is the maximum backoff time before giving up. This is a variable so that code which embeds BuildKit can override the default value.

Functions

func New

func New(f images.HandlerFunc, logger func([]byte)) images.HandlerFunc

func WithRetry added in v0.34.0

func WithRetry[T any](ctx context.Context, logger func([]byte), f func(context.Context) (T, error)) (T, error)

WithRetry retries transient failures with exponential backoff. Nested calls using the supplied context leave retries to the outer call, including New. f must be safe to retry and preserve retryable errors when wrapping them.

func WithRetryIf added in v0.34.0

func WithRetryIf[T any](ctx context.Context, logger func([]byte), f func(context.Context) (T, error), shouldRetry func(error) bool) (T, error)

WithRetryIf applies the normal retry policy only when shouldRetry also accepts the error. A nil predicate accepts all errors in the normal policy. This lets callers avoid retrying errors handled by an enclosing transport.

Types

This section is empty.

Jump to

Keyboard shortcuts

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