retryutil

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Retry

func Retry(interval time.Duration, timeout time.Duration, f func() (bool, error)) error

Retry is a wrapper around RetryWorker that provides a real RetryTicker

func RetryWorker

func RetryWorker(
	interval time.Duration,
	timeout time.Duration,
	tick RetryTicker,
	f func() (bool, error)) error

RetryWorker calls ConditionFunc until either: * it returns boolean true * a timeout expires * an error occurs

Types

type RetryTicker

type RetryTicker interface {
	Stop()
	Tick()
}

RetryTicker is a wrapper aroung time.Tick, that allows to mock its implementation

type Ticker

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

Ticker is a real implementation of RetryTicker interface

func (*Ticker) Stop

func (t *Ticker) Stop()

Stop is a convenience wrapper around ticker.Stop

func (*Ticker) Tick

func (t *Ticker) Tick()

Tick is a convenience wrapper around ticker.C

Jump to

Keyboard shortcuts

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