mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
types: exit ping worker when error is happened
This commit is contained in:
parent
04da8fded7
commit
e61db95bd8
|
@ -274,6 +274,7 @@ func (s *StandardStream) ping(ctx context.Context, conn *websocket.Conn, cancel
|
|||
if err := conn.WriteControl(websocket.PingMessage, nil, time.Now().Add(writeTimeout)); err != nil {
|
||||
log.WithError(err).Error("ping error", err)
|
||||
s.Reconnect()
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -306,6 +307,7 @@ func (s *StandardStream) Connect(ctx context.Context) error {
|
|||
}
|
||||
|
||||
// start one re-connector goroutine with the base context
|
||||
// reconnector goroutine does not exit when the connection is closed
|
||||
go s.reconnector(ctx)
|
||||
|
||||
s.EmitStart()
|
||||
|
|
Loading…
Reference in New Issue
Block a user