Skip to content

Commit cd464b5

Browse files
committed
fix(node_record): handle unexpected websocket errors gracefully in nodeAnalyticRecord function
1 parent f91e551 commit cd464b5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

internal/analytic/node_record.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"sync"
77
"time"
88

9+
"github.com/0xJacky/Nginx-UI/internal/helper"
910
"github.com/0xJacky/Nginx-UI/model"
1011
"github.com/0xJacky/Nginx-UI/query"
1112
"github.com/gorilla/websocket"
@@ -209,7 +210,10 @@ func nodeAnalyticRecord(env *model.Environment, ctx context.Context) error {
209210
for {
210211
err = c.ReadJSON(&nodeStat)
211212
if err != nil {
212-
return err
213+
if helper.IsUnexpectedWebsocketError(err) {
214+
return err
215+
}
216+
return nil
213217
}
214218

215219
// set online

0 commit comments

Comments
 (0)