wait

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UntilWithBackoff

func UntilWithBackoff(ctx context.Context, f func(context.Context) SpeedSignal)

UntilWithBackoff runs f in a loop until context indicates finished. It applies backoff depending on the SpeedSignal f returns. Backoff increases exponentially, ranging from 1ms to 100ms.

Types

type SpeedSignal

type SpeedSignal bool

SpeedSignal indicates whether we should run the function again immediately, or apply backoff.

const (
	// KeepGoing signals to continue immediately.
	KeepGoing SpeedSignal = true
	// SlowDown signals to backoff.
	SlowDown SpeedSignal = false
)

Jump to

Keyboard shortcuts

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