File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,8 @@ func (s *DepthSrv) Start() {
5656 }
5757
5858 log .Debugf ("%s %s depth websocket connected." , s .si .Class , s .si .Symbol )
59+ // Reset the reconnect backoff now that we have a successful connection
60+ d .Reset ()
5961 select {
6062 case <- s .ctx .Done ():
6163 stopC <- struct {}{}
@@ -126,9 +128,14 @@ func (s *DepthSrv) wsHandler(event *spot.WsPartialDepthEvent) {
126128}
127129
128130func (s * DepthSrv ) errHandler (err error ) {
129- if strings .Contains (err .Error (), "context canceled" ) {
131+ msg := err .Error ()
132+ switch {
133+ case strings .Contains (msg , "context canceled" ):
130134 log .Warnf ("%s %s depth websocket context canceled, will restart connection." , s .si .Class , s .si .Symbol )
131- } else {
135+ case strings .Contains (msg , "use of closed network connection" ):
136+ // This commonly indicates a normal remote close/rotation; treat as info/debug to reduce noise
137+ log .Infof ("%s %s depth websocket closed by peer; reconnecting." , s .si .Class , s .si .Symbol )
138+ default :
132139 log .Errorf ("%s %s depth websocket connection error: %s." , s .si .Class , s .si .Symbol , err )
133140 }
134141}
You can’t perform that action at this time.
0 commit comments