Ensure we don't return a nil control channel while starting up

This commit is contained in:
Paul Lorenz
2021-12-07 00:05:16 -05:00
parent 82b5b023a2
commit 56c9159907
3 changed files with 9 additions and 1 deletions
+6
View File
@@ -90,6 +90,12 @@ func (self *Router) MetricsRegistry() metrics.UsageRegistry {
}
func (self *Router) Channel() channel2.Channel {
// if we're just starting up, we may be nil. wait till initialized
// The initial control channel connect has a timeout, so if that timeouts the process will exit
// Once connected the control channel will never get set back to nil. Reconnects happen under the hood
for self.ctrl == nil {
time.Sleep(50 * time.Millisecond)
}
return self.ctrl
}
+1 -1
View File
@@ -106,7 +106,7 @@ func Test_Ordering(t *testing.T) {
}
}()
timeout := time.After(10 * time.Second)
timeout := time.After(20 * time.Second)
req := require.New(t)
for i := 0; i < msgCount; i++ {
+2
View File
@@ -1,3 +1,5 @@
//go:build apitests
package tests
import (