MCPcopy
hub / github.com/nats-io/nats.go / WaitTime

Function WaitTime

test/helper_test.go:48–55  ·  view source on GitHub ↗

Wait for a chan with a timeout.

(ch chan bool, timeout time.Duration)

Source from the content-addressed store, hash-verified

46
47// Wait for a chan with a timeout.
48func WaitTime(ch chan bool, timeout time.Duration) error {
49 select {
50 case <-ch:
51 return nil
52 case <-time.After(timeout):
53 }
54 return errors.New("timeout")
55}
56
57func WaitOnChannel[T comparable](t *testing.T, ch <-chan T, expected T) {
58 t.Helper()

Callers 15

TestConnectHandlerFunction · 0.70
TestReconnectTLSHostNoIPFunction · 0.70
BenchmarkPubSubSpeedFunction · 0.70
TestAuthErrorOnReconnectFunction · 0.70
WaitFunction · 0.70
TestOptionsFunction · 0.70
TestProperReconnectDelayFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected