From 608b15f20d044ccfe0e25ef977c3baee0b397ca2 Mon Sep 17 00:00:00 2001 From: Andrey Lushnikov Date: Thu, 8 Aug 2019 15:15:33 -0700 Subject: [PATCH] chore(flakiness): limit max builds to 100 (#4818) This was missing in #4808 --- utils/flakiness-dashboard/FlakinessDashboard.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/utils/flakiness-dashboard/FlakinessDashboard.js b/utils/flakiness-dashboard/FlakinessDashboard.js index 0f7646f5..407d8fa9 100644 --- a/utils/flakiness-dashboard/FlakinessDashboard.js +++ b/utils/flakiness-dashboard/FlakinessDashboard.js @@ -18,6 +18,7 @@ const RESET_COLOR = '\x1b[0m'; const DASHBOARD_VERSION = 1; const DASHBOARD_FILENAME = 'dashboard.json'; +const DASHBOARD_MAX_BUILDS = 100; class FlakinessDashboard { static async getCommitDetails(repoPath, ref = 'HEAD') { @@ -103,6 +104,8 @@ async function saveBuildToDashboard(dashboardPath, build) { commit: build._commit, tests: build._tests, }); + if (data.builds.length > DASHBOARD_MAX_BUILDS) + data.builds = data.builds.slice(data.builds.length - DASHBOARD_MAX_BUILDS); await writeFileAsync(filePath, JSON.stringify(data)); }