executor

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Retry

func Retry(max int, timeout time.Duration, b interfaces.Balancer) endpoint.Endpoint

Retry returns an Endpoint that retries up to max times within timeout, selecting a new backend from b on each attempt.

func RetryAlways

func RetryAlways(timeout time.Duration, b interfaces.Balancer) endpoint.Endpoint

RetryAlways returns an Endpoint that retries indefinitely until timeout is reached or the call succeeds.

func RetryWithCallback

func RetryWithCallback(timeout time.Duration, b interfaces.Balancer, cb RetryCallback) endpoint.Endpoint

Types

type RetryCallback

type RetryCallback func(n int, received error) (keepTrying bool, replacement error)

RetryCallback is called after each failed attempt. It returns whether the executor should keep trying and an optional replacement error. Returning keepTrying=false stops the retry loop immediately.

type RetryError

type RetryError struct {
	RawErrors []error
	Final     error // nil when the last attempt succeeded
}

RetryError is returned when all retry attempts are exhausted. RawErrors contains every error from each attempt; Final is the last error (or a replacement set by RetryCallback).

func (RetryError) Error

func (e RetryError) Error() string

Jump to

Keyboard shortcuts

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