From 5dc72a16f1c9922677366ba95de5f205a20ccec6 Mon Sep 17 00:00:00 2001 From: dwieeb Date: Tue, 16 Oct 2018 16:42:12 -0500 Subject: [PATCH] chore(ci): batch upload screenshot images (#15978) --- core/scripts/screenshot/ci.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/core/scripts/screenshot/ci.js b/core/scripts/screenshot/ci.js index b1281eed37..d90c926df5 100644 --- a/core/scripts/screenshot/ci.js +++ b/core/scripts/screenshot/ci.js @@ -56,9 +56,14 @@ class CIScreenshotConnector extends IonicConnector { const timespan = this.logger.createTimeSpan(`publishing build started`); const images = currentBuild.screenshots.map(screenshot => screenshot.image); + const imageBatches = []; - for (const image of images) { - await this.uploadImage(image); + while (images.length > 0) { + imageBatches.push(images.splice(0, 10)); + } + + for (const batch of imageBatches) { + await Promise.all(batch.map(async image => this.uploadImage(image))); } const buildBuffer = Buffer.from(JSON.stringify(currentBuild, undefined, 2));