Przeglądaj źródła

perf(base-S-D1): errorLog 列表 slice(0,100) 限制上限,防止内存无限增长

86132 1 tydzień temu
rodzic
commit
dad68da14f
1 zmienionych plików z 2 dodań i 1 usunięć
  1. 2 1
      src/store/modules/errorLog.ts

+ 2 - 1
src/store/modules/errorLog.ts

@@ -33,7 +33,8 @@ export const useErrorLogStore = defineStore({
         ...info,
         time: formatToDateTime(new Date()),
       };
-      this.errorLogInfoList = [item, ...(this.errorLogInfoList || [])];
+      // [perf-base-v1] 上限保留最近 100 条,防止长时间运行错误日志无限累积占用内存
+      this.errorLogInfoList = [item, ...(this.errorLogInfoList || [])].slice(0, 100);
       this.errorLogListCount += 1;
     },