rpcretry

package
v3.32.1 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Default Validators is a set of functions that validate errors that should trigger a retry of the request.
	DefaultValidators = []Validator{
		Validator(errors.IsResourceExhausted),
		Validator(errors.IsUnavailable),
	}
)

Functions

func UnaryClientInterceptor

func UnaryClientInterceptor(opts ...Option) grpc.UnaryClientInterceptor

UnaryClientInterceptor returns a new unary client interceptor that retries the execution of external gRPC calls, the retry attempt will only occur if any of the validators define the error as a trigger.

Types

type Option

type Option func(*options)

Options is an option for the rpcretry clients.

func UseMetadata

func UseMetadata(b bool) Option

UseMetadata establishes if the x-rate-limit headers will be used to dinamically calculate the timeout between requests.

func WithDefaultTimeout

func WithDefaultTimeout(t time.Duration) Option

WithDefaultTimeout sets the default timeout between request retries.

func WithJitter

func WithJitter(f float64) Option

WithJitter determines the value of the fraciton used to create the deviation in the timeout between the requests.

func WithMax

func WithMax(m uint) Option

WithMax sets the value of the maximum amount of times a request will be retried.

func WithValidator

func WithValidator(validators ...Validator) Option

WithValidator sets validators that will be evaluated when validating if a request should be retried.

type Validator

type Validator func(error) bool

Validator is a method that validates if an error should trigger the request retry.

Jump to

Keyboard shortcuts

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