From 140d08e133dd473ad608f91e381108282b7128f4 Mon Sep 17 00:00:00 2001 From: max-ostapenko <1611259+max-ostapenko@users.noreply.github.com> Date: Sat, 27 Jun 2026 21:33:18 +0000 Subject: [PATCH] =?UTF-8?q?=E2=9A=A1=20Optimize=20processBacklog=20loop=20?= =?UTF-8?q?in=20histogram=5Fstorage=5Fsync?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script/histogram_storage_sync.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/script/histogram_storage_sync.js b/script/histogram_storage_sync.js index 34bf520e..695626a1 100644 --- a/script/histogram_storage_sync.js +++ b/script/histogram_storage_sync.js @@ -239,9 +239,9 @@ async function processBacklog() { console.log(`\nProcessing ${BACKLOG.length} backlog files...`) let ok = 0, fail = 0 - for (const filename of BACKLOG) { + await mapLimit(BACKLOG, 10, async (filename) => { const match = filename.match(/reports\/(?:([^/]+)\/)?(\d{4}_\d{2}_\d{2})\/(.+?)(?:\.json)?$/) - if (!match) { console.log(`✗ ${filename}: invalid format`); fail++; continue } + if (!match) { console.log(`✗ ${filename}: invalid format`); fail++; return } const [, lensPath = '', dateStr, metric] = match const date = dateStr.replace(/_/g, '-') @@ -261,7 +261,7 @@ async function processBacklog() { console.log(`✗ ${filename}: ${result.error}`) fail++ } - } + }) console.log(`Backlog: ${ok} ok, ${fail} failed\n`) }