waitfor

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrTimedOut = fmt.Errorf("timeout waiting for condition")

ErrTimedOut is returned when WaitFor exceeds the configured timeout.

Functions

func After

func After(clk quartz.Clock, d time.Duration) <-chan time.Time

After returns a channel that sends the current time after duration d using the provided clock. If clk is nil, a real clock is used.

func WaitFor

func WaitFor(ctx context.Context, timeout WaitTimeout, condition func() (bool, error)) error

WaitFor polls condition with exponential backoff until it returns true, an error, or the timeout expires.

Types

type WaitTimeout

type WaitTimeout struct {
	Timeout     time.Duration
	MinInterval time.Duration
	MaxInterval time.Duration
	InitialWait bool
	Clock       quartz.Clock
}

WaitTimeout configures the polling behavior of WaitFor.

Jump to

Keyboard shortcuts

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