Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func BackoffWithContext ¶
func BackoffWithContext(ctx context.Context, cfg Config, opFn func(context.Context) (bool, error)) error
BackoffWithContext repeatedly calls the operation until timeout is reached, it returns true, an error, or the context is canceled. It waits between attempts using exponential backoff, starting from Config.BaseDelay and increasing by Config.Factor, capped by Config.MaxDelay if set.
Types ¶
type Config ¶
type Config struct {
// Initial delay before first retry
BaseDelay time.Duration
// Multiplier for delay on each retry
Factor float64
// Optional maximum delay between retries
MaxDelay time.Duration
// MaxSteps limits the number of retries. If 0, retries will continue until timeout.
MaxSteps int
}
Config defines parameters for exponential backoff polling.
Click to show internal directories.
Click to hide internal directories.