Don't create a new loaderWorker until we need one.

This was causing issues on single core systems after I got rid of the active status as we had already reached the max number of workers.
Instead, we just create a loaderWorker when needed as loaderWorkers are small enough!
This commit is contained in:
j433866 2019-04-30 15:23:41 +01:00
parent 6d8bf3a08a
commit 2fff18cb61
1 changed files with 1 additions and 5 deletions

View File

@ -91,9 +91,6 @@ class InputWaiter {
}); });
this.inputWorker.addEventListener("message", this.handleInputWorkerMessage.bind(this)); this.inputWorker.addEventListener("message", this.handleInputWorkerMessage.bind(this));
if (this.loaderWorkers.length === 0) {
this.activateLoaderWorker();
}
} }
@ -101,7 +98,7 @@ class InputWaiter {
* Activates a loaderWorker and sends it to the InputWorker * Activates a loaderWorker and sends it to the InputWorker
*/ */
activateLoaderWorker() { activateLoaderWorker() {
const workerIdx = this.addLoaderWorker(true); const workerIdx = this.addLoaderWorker();
if (workerIdx === -1) return; if (workerIdx === -1) return;
const workerObj = this.loaderWorkers[workerIdx]; const workerObj = this.loaderWorkers[workerIdx];
@ -117,7 +114,6 @@ class InputWaiter {
/** /**
* Adds a new loaderWorker * Adds a new loaderWorker
* *
* @param {boolean} [active=false]
* @returns {number} The index of the created worker * @returns {number} The index of the created worker
*/ */
addLoaderWorker() { addLoaderWorker() {