MCPcopy Create free account
hub / github.com/abiosoft/colima / Retry

Method Retry

cli/chain.go:151–162  ·  view source on GitHub ↗

Retry retries `f` up to `count` times at interval. If after `count` attempts there is an error, the command chain is terminated with the final error. retryCount starts from 1.

(stage string, interval time.Duration, count int, f func(retryCount int) error)

Source from the content-addressed store, hash-verified

149// If after `count` attempts there is an error, the command chain is terminated with the final error.
150// retryCount starts from 1.
151func (a *ActiveCommandChain) Retry(stage string, interval time.Duration, count int, f func(retryCount int) error) {
152 a.Add(func() (err error) {
153 var i int
154 for err = f(i + 1); i < count && err != nil; i, err = i+1, f(i+1) {
155 if stage != "" {
156 a.log.Println(stage, "...")
157 }
158 time.Sleep(interval)
159 }
160 return err
161 })
162}

Callers 7

StartMethod · 0.80
installK3sClusterFunction · 0.80
StartMethod · 0.80
StartMethod · 0.80
StopMethod · 0.80
TeardownMethod · 0.80
startDaemonMethod · 0.80

Calls 1

AddMethod · 0.95

Tested by

no test coverage detected