Skip to content

Commit

Permalink
Merge fad004f into 6ca7eca
Browse files Browse the repository at this point in the history
  • Loading branch information
bkendall committed Nov 19, 2018
2 parents 6ca7eca + fad004f commit 529e8b9
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions src/deploy/hosting/uploader.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,8 @@ const MAX_UPLOAD_TIMEOUT = 7200000; // 2h

function _progressMessage(message, current, total) {
current = Math.min(current, total);
return (
message +
" [" +
current +
"/" +
total +
"] (" +
clc.bold.green(Math.floor(((current * 1.0) / total) * 100).toString() + "%") +
")"
);
const percent = Math.floor(((current * 1.0) / total) * 100).toString();
return `${message} [${current}/${total}] (${clc.bold.green(`${percent}%`)})`;
}

class Uploader {
Expand Down Expand Up @@ -99,7 +91,7 @@ class Uploader {
})
.then(function() {
logger.debug("[hosting][populate queue][FINAL]", self.populateQueue.stats());
logger.debug("[hosting] uploads queued:", self.uploadQueue.tasks.length);
logger.debug("[hosting] uploads queued:", self.uploadQueue.stats().total);
self.uploadQueue.close();
});

Expand Down Expand Up @@ -136,7 +128,7 @@ class Uploader {
return _progressMessage(
"uploading new files",
this.uploadQueue.complete,
this.uploadQueue.tasks.length
this.uploadQueue.stats().total
);
} else {
return "upload complete";
Expand Down Expand Up @@ -187,7 +179,7 @@ class Uploader {

queuePopulate() {
const pop = this.populateBatch;
this.populateQueue.add(pop, "batch" + (this.populateQueue.tasks.length + 1));
this.populateQueue.add(pop, "batch" + (this.populateQueue.stats().total + 1));
this.populateBatch = {};
this.populateQueue.process();
}
Expand Down

0 comments on commit 529e8b9

Please sign in to comment.