+ /**
+ * Increase the number of tasks that the given workers has done.
+ *
+ * @param worker Workers whose tasks are increased.
+ */
+ protected decreaseWorkersTasks (worker: Worker): void {
+ const numberOfTasksTheWorkerHas = this.tasks.get(worker)
+ if (numberOfTasksTheWorkerHas !== undefined) {
+ this.tasks.set(worker, numberOfTasksTheWorkerHas - 1)
+ } else {
+ throw Error('Worker could not be found in tasks map')
+ }
+ }
+