From bbfeedcdb34676d6ef7142c370aeeda1fcf03b7d Mon Sep 17 00:00:00 2001 From: kuaifan Date: Tue, 5 Aug 2025 07:09:13 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E9=87=8D=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/assets/js/store/actions.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/resources/assets/js/store/actions.js b/resources/assets/js/store/actions.js index cf8d37d2c..c12f61dc3 100644 --- a/resources/assets/js/store/actions.js +++ b/resources/assets/js/store/actions.js @@ -4118,6 +4118,15 @@ export default { return; } // + if (typeof window.wsInfo === "undefined") { + window.wsInfo = { + msgCount: 0, + repeatCount: 0, + lastTime: 0, + lastData: null, + } + } + // let url = $A.mainUrl('ws'); url = url.replace("https://", "wss://"); url = url.replace("http://", "ws://"); @@ -4166,6 +4175,16 @@ export default { wgLog && console.log("[WS] Preload", e); return; } + // + if ($A.dayjs().unix() - window.wsInfo.lastTime < 3 && window.wsInfo.lastData === e.data) { + console.log("[WS] Repeat", e, window.wsInfo.repeatCount); + window.wsInfo.repeatCount++ + return + } + window.wsInfo.msgCount++ + window.wsInfo.lastTime = $A.dayjs().unix() + window.wsInfo.lastData = e.data + // wgLog && console.log("[WS] Message", e); let result = $A.jsonParse(e.data); if (result.type === "encrypt" && result.encrypted) {