MCPcopy Index your code
hub / github.com/cortesi/devd / waitTimeout

Function waitTimeout

watch_test.go:24–36  ·  view source on GitHub ↗

waitTimeout waits for the waitgroup for the specified max timeout. Returns true if waiting timed out.

(wg *sync.WaitGroup, timeout time.Duration)

Source from the content-addressed store, hash-verified

22// waitTimeout waits for the waitgroup for the specified max timeout.
23// Returns true if waiting timed out.
24func waitTimeout(wg *sync.WaitGroup, timeout time.Duration) bool {
25 c := make(chan struct{})
26 go func() {
27 defer close(c)
28 wg.Wait()
29 }()
30 select {
31 case <-c:
32 return false // completed normally
33 case <-time.After(timeout):
34 return true // timed out
35 }
36}
37
38func TestRouteWatch(t *testing.T) {
39 logger := termlog.NewLog()

Callers 1

TestRouteWatchFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected