mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-01 15:10:44 +00:00
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
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user