diff --git a/server/websocket/internal/logic/ws_statistics.go b/server/websocket/internal/logic/ws_statistics.go index 390d8a4e..4d4e3c60 100644 --- a/server/websocket/internal/logic/ws_statistics.go +++ b/server/websocket/internal/logic/ws_statistics.go @@ -75,6 +75,9 @@ func decreaseWebsocketConnectCount(userId, guestId int64) { select { case websocketStat <- data: curWsTotalCount += data.Num + if curWsTotalCount < 0 { + curWsTotalCount = 0 + } return case <-time.After(time.Millisecond * 200): logx.Error("decreaseWebsocketConnectCount 输入管道超时,丢弃消息") @@ -111,6 +114,9 @@ func decreaseCombineRequestCount(userId, guestId int64) { select { case websocketStat <- data: curCombineTotalCount += data.Num + if curCombineTotalCount < 0 { + curCombineTotalCount = 0 + } return case <-time.After(time.Millisecond * 200): logx.Error("decreaseCombineRequestCount 输入管道超时,丢弃消息") @@ -165,6 +171,9 @@ func decreaseUnityRequestCount(userId, guestId int64) { select { case websocketStat <- data: curUnityHandleTotalCount += data.Num + if curUnityHandleTotalCount < 0 { + curUnityHandleTotalCount = 0 + } return case <-time.After(time.Millisecond * 200): logx.Error("decreaseUnityRequestCount 输入管道超时,丢弃消息")