From fdd9363fbfc93f1feb84dadf4c3a432ad2910790 Mon Sep 17 00:00:00 2001 From: Hassy Veldstra Date: Thu, 4 Apr 2024 13:10:01 +0100 Subject: [PATCH] fix: wait for upload to complete (#2623) --- packages/artillery/lib/platform/cloud/cloud.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/artillery/lib/platform/cloud/cloud.js b/packages/artillery/lib/platform/cloud/cloud.js index ca77f03402..5ac13e8fa8 100644 --- a/packages/artillery/lib/platform/cloud/cloud.js +++ b/packages/artillery/lib/platform/cloud/cloud.js @@ -249,15 +249,14 @@ class ArtilleryCloudPlugin { watcher.on('add', (fp) => { if (path.basename(fp).startsWith('trace-') && fp.endsWith('.zip')) { setTimeout(() => { + this.uploading++; this._uploadAsset(fp); - }, 10 * 1000); + }, 5 * 1000); } }); } async _uploadAsset(localFilename) { - this.uploading++; - const payload = { testRunId: this.testRunId, filenames: [path.basename(localFilename)] @@ -307,14 +306,14 @@ class ArtilleryCloudPlugin { async waitOnUnprocessedLogs(maxWaitTime) { let waitedTime = 0; while ( - this.unprocessedLogsCounter > 0 && - this.uploading > 0 && + (this.unprocessedLogsCounter > 0 || this.uploading > 0) && waitedTime < maxWaitTime ) { debug('waiting on unprocessed logs'); await sleep(500); waitedTime += 500; } + return true; }