From 5f2d2f5b2665df604b1eb98af81a56b9d622aeb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9A=8F=E9=A3=8E?= Date: Fri, 24 Sep 2021 11:09:23 +0800 Subject: [PATCH] feat: add max limit lines to log (#1346) --- shell/app/common/stores/common.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/shell/app/common/stores/common.ts b/shell/app/common/stores/common.ts index 0ba6398e7f..395df61028 100644 --- a/shell/app/common/stores/common.ts +++ b/shell/app/common/stores/common.ts @@ -73,6 +73,10 @@ const common = createStore({ newLines = oldLines; emptyTimes += 1; } + const LIMIT = 5000; + if (newLines.length > LIMIT) { + newLines = count > 0 ? newLines.slice(-LIMIT) : newLines.slice(0, LIMIT); + } // 空的次数大于2次后,开始延长拉取周期,最长1分钟 if (emptyTimes > 2 && fetchPeriod < 60 * 1000) { fetchPeriod += defaultLogPeriod;