diff --git a/internal/outpost/ak/api_ws.go b/internal/outpost/ak/api_ws.go index 2bb4f5ec2b..c1beb69a9b 100644 --- a/internal/outpost/ak/api_ws.go +++ b/internal/outpost/ak/api_ws.go @@ -116,6 +116,11 @@ func (ac *APIController) startWSHandler() { logger := ac.logger.WithField("loop", "ws-handler") for { var wsMsg websocketMessage + if ac.wsConn == nil { + go ac.reconnectWS() + time.Sleep(time.Second * 5) + continue + } err := ac.wsConn.ReadJSON(&wsMsg) if err != nil { ConnectionStatus.With(prometheus.Labels{ @@ -163,6 +168,11 @@ func (ac *APIController) startWSHealth() { "uuid": ac.instanceUUID.String(), }, } + if ac.wsConn == nil { + go ac.reconnectWS() + time.Sleep(time.Second * 5) + continue + } err := ac.wsConn.WriteJSON(aliveMsg) ac.logger.WithField("loop", "ws-health").Trace("hello'd") if err != nil { diff --git a/tests/e2e/test_provider_proxy.py b/tests/e2e/test_provider_proxy.py index a3c662b583..7c1e9622a4 100644 --- a/tests/e2e/test_provider_proxy.py +++ b/tests/e2e/test_provider_proxy.py @@ -158,7 +158,7 @@ class TestProviderProxyConnect(ChannelsLiveServerTestCase): sleep(0.5) state = outpost.state - self.assertEqual(len(state), 1) + self.assertTrue(len(state) >= 1) self.assertEqual(state[0].version, __version__) # Make sure to delete the outpost to remove the container