reliable

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MinBackoff time.Duration = 10 * time.Millisecond
	MaxBackoff time.Duration = 15 * time.Second
)

Variables

This section is empty.

Functions

func NextBackoff

func NextBackoff(d time.Duration) time.Duration

func NextBackoffCustom

func NextBackoffCustom(d, jmin, jmax time.Duration) time.Duration

func NextDeline

func NextDeline(d time.Duration) time.Duration

func RunGroup

func RunGroup(ctx context.Context, fns ...RunFn) error

func Wait

func Wait(ctx context.Context, d time.Duration) error

func WaitDeline added in v0.9.1

func WaitDeline(ctx context.Context, d time.Duration) error

Types

type Group

type Group struct {
	// contains filtered or unexported fields
}

func NewGroup

func NewGroup(ctx context.Context) *Group

func (*Group) Go

func (g *Group) Go(fns ...RunFn) *Group

func (*Group) Wait

func (g *Group) Wait() error

type RunFn

type RunFn func(context.Context) error

func Bind

func Bind[T any](t T, fn func(context.Context, T) error) RunFn

func Schedule

func Schedule(d time.Duration, fn RunFn) RunFn

func ScheduleDelayed

func ScheduleDelayed(delay, d time.Duration, fn RunFn) RunFn

func ScheduleNow

func ScheduleNow(d time.Duration, fn RunFn) RunFn

type SpinBackoff

type SpinBackoff struct {
	MinBackoff time.Duration
	MaxBackoff time.Duration
	// contains filtered or unexported fields
}

func (*SpinBackoff) Wait

func (s *SpinBackoff) Wait(ctx context.Context) error

Wait will block on backoff if called too often

Jump to

Keyboard shortcuts

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