From 86a540173d4807d338678d1ed6e81f20b2184d7d Mon Sep 17 00:00:00 2001 From: Gareth Kirwan Date: Mon, 5 Jun 2023 02:51:43 +0100 Subject: [PATCH] websocket: Fix redundant connection monitor error upon disconnect (#1210) When an existing ws disconnects the connection manager goro will call Connect. This prevents Connect trying to start another connection manager if it's already running --- exchanges/stream/websocket.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/exchanges/stream/websocket.go b/exchanges/stream/websocket.go index 8632cba3..1b674a4b 100644 --- a/exchanges/stream/websocket.go +++ b/exchanges/stream/websocket.go @@ -261,12 +261,14 @@ func (w *Websocket) Connect() error { w.setConnectingStatus(false) w.setInit(true) - err = w.connectionMonitor() - if err != nil { - log.Errorf(log.WebsocketMgr, - "%s cannot start websocket connection monitor %v", - w.GetName(), - err) + if !w.IsConnectionMonitorRunning() { + err = w.connectionMonitor() + if err != nil { + log.Errorf(log.WebsocketMgr, + "%s cannot start websocket connection monitor %v", + w.GetName(), + err) + } } subs, err := w.GenerateSubs() // regenerate state on new connection