This commit is contained in:
laodaming 2023-10-31 15:08:00 +08:00
parent 485319d4f8
commit 8c026be22d

View File

@ -96,7 +96,11 @@ func ConsumeWebsocketStatData(ctx context.Context) {
if ok { //存在就累加 if ok { //存在就累加
if stat, ok := statData.(mapUserWsStatItem); ok { if stat, ok := statData.(mapUserWsStatItem); ok {
stat.CurWsConnectCount += data.Value stat.CurWsConnectCount += data.Value
mapUserWsStat.Store(key, stat) if stat.CurWsConnectCount == 0 { //为0则移除
mapUserWsStat.Delete(key)
} else {
mapUserWsStat.Store(key, stat)
}
} else { } else {
logx.Error("断言mapUserWsStatItem错误") logx.Error("断言mapUserWsStatItem错误")
} }