I forgot how timeout works. it should work now
This commit is contained in:
@@ -110,13 +110,13 @@ var UploadManager = /** @class */ (function () {
|
|||||||
this.uploadQueue.push(file);
|
this.uploadQueue.push(file);
|
||||||
if (this.uploadThreads.length < this.maxThreads) {
|
if (this.uploadThreads.length < this.maxThreads) {
|
||||||
console.debug("Starting upload thread");
|
console.debug("Starting upload thread");
|
||||||
var thread = new UploadWorker(this);
|
var thread_1 = new UploadWorker(this);
|
||||||
this.uploadThreads.push(thread);
|
this.uploadThreads.push(thread_1);
|
||||||
setTimeout(thread.start(), 0); // Start a new upload thread
|
setTimeout(function () { thread_1.start(); }, 0); // Start a new upload thread
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for (var i = 0; i < this.uploadThreads.length; i++) {
|
for (var i = 0; i < this.uploadThreads.length; i++) {
|
||||||
setTimeout(this.uploadThreads[i].start(), 0);
|
setTimeout(function () { this.uploadThreads[i].start(); }, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -186,12 +186,12 @@ var UploadWorker = /** @class */ (function () {
|
|||||||
if (that.tries === 3) {
|
if (that.tries === 3) {
|
||||||
alert("Upload failed: " + status);
|
alert("Upload failed: " + status);
|
||||||
file.onFailure(status, error);
|
file.onFailure(status, error);
|
||||||
setTimeout(that.newFile(), 2000); // Try to continue
|
setTimeout(function () { that.newFile(); }, 2000); // Try to continue
|
||||||
return; // Upload failed
|
return; // Upload failed
|
||||||
}
|
}
|
||||||
// Try again
|
// Try again
|
||||||
that.tries++;
|
that.tries++;
|
||||||
setTimeout(that.upload(file), that.tries * 3000);
|
setTimeout(function () { that.upload(file); }, that.tries * 3000);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@@ -18,10 +18,10 @@ class UploadManager {
|
|||||||
console.debug("Starting upload thread")
|
console.debug("Starting upload thread")
|
||||||
let thread = new UploadWorker(this)
|
let thread = new UploadWorker(this)
|
||||||
this.uploadThreads.push(thread)
|
this.uploadThreads.push(thread)
|
||||||
setTimeout(thread.start(), 0) // Start a new upload thread
|
setTimeout(function(){thread.start()}, 0) // Start a new upload thread
|
||||||
} else {
|
} else {
|
||||||
for (var i = 0; i < this.uploadThreads.length; i++) {
|
for (var i = 0; i < this.uploadThreads.length; i++) {
|
||||||
setTimeout(this.uploadThreads[i].start(), 0)
|
setTimeout(function(){this.uploadThreads[i].start()}, 0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -101,13 +101,13 @@ class UploadWorker {
|
|||||||
alert("Upload failed: " + status);
|
alert("Upload failed: " + status);
|
||||||
file.onFailure(status, error)
|
file.onFailure(status, error)
|
||||||
|
|
||||||
setTimeout(that.newFile(), 2000) // Try to continue
|
setTimeout(function(){that.newFile()}, 2000) // Try to continue
|
||||||
return; // Upload failed
|
return; // Upload failed
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try again
|
// Try again
|
||||||
that.tries++
|
that.tries++
|
||||||
setTimeout(that.upload(file), that.tries*3000)
|
setTimeout(function(){that.upload(file)}, that.tries*3000)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user