MCPcopy Index your code
hub / github.com/perkeep/perkeep / WaitFor

Function WaitFor

pkg/test/wait.go:23–33  ·  view source on GitHub ↗

WaitFor returns true if condition returns true before maxWait. It is checked immediately, and then every checkInterval.

(condition func() bool, maxWait, checkInterval time.Duration)

Source from the content-addressed store, hash-verified

21// WaitFor returns true if condition returns true before maxWait.
22// It is checked immediately, and then every checkInterval.
23func WaitFor(condition func() bool, maxWait, checkInterval time.Duration) bool {
24 t0 := time.Now()
25 tmax := t0.Add(maxWait)
26 for time.Now().Before(tmax) {
27 if condition() {
28 return true
29 }
30 time.Sleep(checkInterval)
31 }
32 return false
33}

Callers 1

pkmountTestFunction · 0.92

Calls 1

AddMethod · 0.45

Tested by 1

pkmountTestFunction · 0.74