wait

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2022 License: Apache-2.0 Imports: 9 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrTimeOut = errors.New("timed out waiting for the condition")
View Source
var LogStatus = &LogCommandStatus{
	IsRunning: false,
}

Functions

func GetLogStatus

func GetLogStatus() bool

Read log status

func PollForever

func PollForever(interval time.Duration, done <-chan string, condition ConditionFunc) (string, error)

Keep polling a condition func until it return a message or an error PollForever always wait interval PollForever will keep polling forever, no timeout

func PollRetry

func PollRetry(retry int, interval time.Duration, condition ConditionFunc) error

PollRetry repeats running condition functions with a backoff until it runs successfully Or it already retried multiple times which is set in config The backoff time will be retry * interval

func PollUntil

func PollUntil(interval time.Duration, done <-chan string, timeout time.Duration, condition ConditionFunc) (string, error)

Keep polling a condition func until timeout or a message/error is returned

func RetryCmd

func RetryCmd(retry int, cmd *exec.Cmd) ([]byte, error)

Retry command util reach the maximum try out count

func RetryCmdLogs

func RetryCmdLogs(cmd *exec.Cmd, retry bool) ([]byte, error)

Retry command forever

func SetLogStatus

func SetLogStatus(logCommandRunSuccess bool)

Set log status

func WaitCmd

func WaitCmd(timeout time.Duration, cmd_result *types.CmdResult) error

wait on exec command finished or timeout

func WaitUntil

func WaitUntil(timeout time.Duration, condition ConditionCHFunc) (string, error)

Run condition in goroutine, wait for condition's return until timeout If timeout, return ErrTimeOut If message received from condition, return message

Types

type ConditionCHFunc

type ConditionCHFunc func(done chan string)

type ConditionFunc

type ConditionFunc func() (string, error)

type LogCommandStatus

type LogCommandStatus struct {
	sync.RWMutex
	IsRunning bool
}

Jump to

Keyboard shortcuts

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