Skip to content

Commit 3d6db4d

Browse files
committed
fix upload simultaneousUploads bug
1 parent 1dafd01 commit 3d6db4d

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

src/flow.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -442,20 +442,31 @@
442442
});
443443
return uploading;
444444
},
445+
446+
uploadingNum: function () {
447+
var num = 0;
448+
each(this.files, function (file) {
449+
if (file.isUploading()) {
450+
num++;
451+
}
452+
});
453+
return num;
454+
},
445455

446456
/**
447457
* Start or resume uploading.
448458
* @function
449459
*/
450460
upload: function () {
451461
// Make sure we don't start too many uploads at once
452-
if (this.isUploading()) {
462+
var uploadingNum = this.uploadingNum();
463+
if (uploadingNum >= this.opts.simultaneousUploads) {
453464
return;
454465
}
455466
// Kick off the queue
456467
this.fire('uploadStart');
457468
var started = false;
458-
for (var num = 1; num <= this.opts.simultaneousUploads; num++) {
469+
for (var num = 1; num <= this.opts.simultaneousUploads - uploadingNum; num++) {
459470
started = this.uploadNextChunk(true) || started;
460471
}
461472
if (!started) {

0 commit comments

Comments
 (0)