This commit is contained in:
Alex Yang
2026-04-01 12:22:55 +08:00
parent 61789061ce
commit efebce3c39
46 changed files with 4797716 additions and 462145 deletions
+7 -2
View File
@@ -129,8 +129,13 @@ function setupReconnect() {
}, reconnectDelay);
}
// 处理实时数据更新 - 添加节流机制
// 处理实时数据更新 - 添加节流机制和页面可见性检查
function processRealTimeData(stats) {
// 页面不可见时跳过处理,节省资源
if (document.hidden) {
return;
}
// 节流处理,限制执行频率
const now = Date.now();
if (now - lastProcessedTime < PROCESS_THROTTLE_INTERVAL) {
@@ -140,7 +145,7 @@ function processRealTimeData(stats) {
try {
// 确保stats是有效的对象
// 确保 stats 是有效的对象
if (!stats || typeof stats !== 'object') {
console.error('无效的实时数据:', stats);
return;