ret

package
v1.2.9 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2025 License: MIT Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRetryAfter

func GetRetryAfter(a any) time.Duration

func RetryForError

func RetryForError(ctx context.Context, api func() error, retries int, logger log.Logger) error

RetryForError loop max `retries` count to call api(). returns the error if api() returns a non Retryable error.

Types

type RetryError

type RetryError struct {
	Err        error
	RetryAfter time.Duration
}

func NewRetryError

func NewRetryError(err error, retryAfter ...time.Duration) *RetryError

func (*RetryError) Error

func (re *RetryError) Error() string

func (*RetryError) GetRetryAfter

func (re *RetryError) GetRetryAfter() time.Duration

func (*RetryError) Unwrap

func (re *RetryError) Unwrap() error

type Retryable

type Retryable interface {
	GetRetryAfter() time.Duration
}

Jump to

Keyboard shortcuts

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