From d6157d3b78b9f32d9b920c1912f087333209ce10 Mon Sep 17 00:00:00 2001 From: Khafra Date: Fri, 31 May 2024 17:10:10 -0400 Subject: [PATCH] fix: batch requests in wpt --- lib/wpt/index.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/wpt/index.js b/lib/wpt/index.js index 601b207b..4438d340 100644 --- a/lib/wpt/index.js +++ b/lib/wpt/index.js @@ -79,9 +79,12 @@ export class WPTUpdater { await removeDirectory(this.fixtures(this.path)); this.cli.startSpinner('Pulling assets...'); - await Promise.all(assets.map( - (asset) => this.pullTextFile(fixtures, asset.name) - )); + for (let i = 0; i < assets.length; i += 10) { + const chunk = assets.slice(i, i + 10); + await Promise.all(chunk.map( + (asset) => this.pullTextFile(fixtures, asset.name) + )); + } this.cli.stopSpinner(`Downloaded ${assets.length} assets.`); return assets;