fix threads again

This commit is contained in:
2018-01-17 11:19:16 +01:00
parent 54f18cacf5
commit ff1d240889
2 changed files with 4 additions and 4 deletions

View File

@@ -103,7 +103,7 @@ var UploadManager = /** @class */ (function () {
function UploadManager() { function UploadManager() {
this.uploadQueue = new Array(); this.uploadQueue = new Array();
this.uploadThreads = new Array(); this.uploadThreads = new Array();
this.maxThreads = 2; this.maxThreads = 3;
} }
UploadManager.prototype.uploadFile = function (file) { UploadManager.prototype.uploadFile = function (file) {
console.debug("Adding upload to queue"); console.debug("Adding upload to queue");
@@ -116,7 +116,7 @@ var UploadManager = /** @class */ (function () {
} }
else { else {
for (var i = 0; i < this.uploadThreads.length; i++) { for (var i = 0; i < this.uploadThreads.length; i++) {
setTimeout(function () { this.uploadThreads[i].start(); }, 0); this.uploadThreads[i].start();
} }
} }
}; };

View File

@@ -8,7 +8,7 @@ interface FileUpload {
class UploadManager { class UploadManager {
private uploadQueue: Array<FileUpload> = new Array(); private uploadQueue: Array<FileUpload> = new Array();
private uploadThreads: Array<UploadWorker> = new Array(); private uploadThreads: Array<UploadWorker> = new Array();
private maxThreads: number = 2; private maxThreads: number = 3;
public uploadFile(file: FileUpload) { public uploadFile(file: FileUpload) {
console.debug("Adding upload to queue") console.debug("Adding upload to queue")
@@ -21,7 +21,7 @@ class UploadManager {
setTimeout(function(){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(function(){this.uploadThreads[i].start()}, 0) this.uploadThreads[i].start()
} }
} }
} }