From 21f06c6e39e4e23a0b468b7cd1156047a0f54138 Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Tue, 31 Oct 2023 17:46:15 +0800 Subject: [PATCH] fix --- server/websocket/internal/logic/ws_statistics.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/server/websocket/internal/logic/ws_statistics.go b/server/websocket/internal/logic/ws_statistics.go index 7d086c1c..ad49d752 100644 --- a/server/websocket/internal/logic/ws_statistics.go +++ b/server/websocket/internal/logic/ws_statistics.go @@ -114,13 +114,17 @@ func ConsumeWebsocketStatData(ctx context.Context) { } case TYPE_COMBINE_IMAGE_REQUEST_COUNT: //请求算法合图计数 statData, ok := mapUserWsStat.Load(key) + //不存在 if !ok { - if data.Value > 0 { - mapUserWsStat.Store(key, mapUserWsStatItem{ - CurCombineCount: data.Value, - }) + //数据是减少的 + if data.Value <= 0 { + continue } + mapUserWsStat.Store(key, mapUserWsStatItem{ + CurCombineCount: data.Value, + }) } + //存在 if stat, ok := statData.(mapUserWsStatItem); ok { stat.CurCombineCount += data.Value if stat.CurCombineCount < 0 {