mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 01:01:56 +00:00
Merge pull request #1742 from c9s/c9s/fix-ws-close-err
FIX: types/stream: change errorf to warnf
This commit is contained in:
commit
0d6b7b29d5
|
@ -249,7 +249,7 @@ func (s *StandardStream) Read(ctx context.Context, conn *websocket.Conn, cancel
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if err := conn.SetReadDeadline(time.Now().Add(readTimeout)); err != nil {
|
if err := conn.SetReadDeadline(time.Now().Add(readTimeout)); err != nil {
|
||||||
log.WithError(err).Errorf("set read deadline error: %s", err.Error())
|
log.WithError(err).Errorf("unable to set read deadline: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
mt, message, err := conn.ReadMessage()
|
mt, message, err := conn.ReadMessage()
|
||||||
|
@ -300,7 +300,7 @@ func (s *StandardStream) Read(ctx context.Context, conn *websocket.Conn, cancel
|
||||||
var e interface{}
|
var e interface{}
|
||||||
e, err = s.parser(message)
|
e, err = s.parser(message)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.WithError(err).Errorf("websocket event parse error, message: %s", message)
|
log.WithError(err).Errorf("unable to parse the websocket message. err: %v, message: %s", err, message)
|
||||||
// emit raw message even if occurs error, because we want anything can be detected
|
// emit raw message even if occurs error, because we want anything can be detected
|
||||||
s.EmitRawMessage(message)
|
s.EmitRawMessage(message)
|
||||||
continue
|
continue
|
||||||
|
@ -352,7 +352,7 @@ func (s *StandardStream) ping(
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := conn.WriteControl(websocket.PingMessage, nil, time.Now().Add(writeTimeout)); err != nil {
|
if err := conn.WriteControl(websocket.PingMessage, nil, time.Now().Add(writeTimeout)); err != nil {
|
||||||
log.WithError(err).Error("ping error", err)
|
log.WithError(err).Warnf("unable to write ws control message, ping error: %v", err)
|
||||||
s.Reconnect()
|
s.Reconnect()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -439,7 +439,7 @@ func (s *StandardStream) reconnector(ctx context.Context) {
|
||||||
|
|
||||||
log.Warnf("re-connecting...")
|
log.Warnf("re-connecting...")
|
||||||
if err := s.DialAndConnect(ctx); err != nil {
|
if err := s.DialAndConnect(ctx); err != nil {
|
||||||
log.WithError(err).Errorf("re-connect error, try to reconnect later")
|
log.WithError(err).Warnf("re-connect error: %v, will reconnect again later...", err)
|
||||||
|
|
||||||
// re-emit the re-connect signal if error
|
// re-emit the re-connect signal if error
|
||||||
s.Reconnect()
|
s.Reconnect()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user