Skip to content

Commit

Permalink
fix: wait for upload to complete (#2623)
Browse files Browse the repository at this point in the history
  • Loading branch information
hassy committed Apr 4, 2024
1 parent df6a3cf commit fdd9363
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions packages/artillery/lib/platform/cloud/cloud.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit fdd9363

Please sign in to comment.