wait

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0, MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Jitter

func Jitter(base time.Duration, factor float64) time.Duration

Jitter returns a random duration ranging from base to base+base*factor

func RepeatUntil

func RepeatUntil(ctx context.Context, period time.Duration, c CheckFunc) error

RepeatUntil runs c every period until the context is done, c returns an error or c returns true to indicate completion.

func SleepWithJitter

func SleepWithJitter(base time.Duration, factor float64)

SleepWithJitter sleeps for a random duration ranging from base to base+base*factor

func Until

func Until(ctx context.Context, f func(context.Context) error) error

Until runs f until the context is done or f returns.

Types

type CheckFunc

type CheckFunc func(context.Context) (bool, error)

A CheckFunc returns true when the check has been passed and false if it has not.

Jump to

Keyboard shortcuts

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