X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fworker%2FWorkerSet.ts;h=956d97de0f07b54f0ce627f4620642205963de2a;hb=6d9876e7b9b024879f1463aa7407c6874c5ca06b;hp=6e890902d8f8c769e726a262e5c013c39334b604;hpb=e7aeea18e189dd087c8f951cf77a253e2818ae90;p=e-mobility-charging-stations-simulator.git diff --git a/src/worker/WorkerSet.ts b/src/worker/WorkerSet.ts index 6e890902..956d97de 100644 --- a/src/worker/WorkerSet.ts +++ b/src/worker/WorkerSet.ts @@ -1,9 +1,9 @@ // Partial Copyright Jerome Benoit. 2021. All Rights Reserved. -import { WorkerData, WorkerMessageEvents, WorkerOptions, WorkerSetElement } from '../types/Worker'; +import { Worker } from 'worker_threads'; +import { WorkerData, WorkerMessageEvents, WorkerOptions, WorkerSetElement } from '../types/Worker'; import Utils from '../utils/Utils'; -import { Worker } from 'worker_threads'; import WorkerAbstract from './WorkerAbstract'; import { WorkerUtils } from './WorkerUtils'; @@ -46,6 +46,7 @@ export default class WorkerSet extends WorkerAbstract { throw new Error("Cannot add a WorkerSet element: workers' set does not exist"); } if ( + this.workerSet.size === 0 || this.getLastWorkerSetElement().numberOfWorkerElements >= this.workerOptions.elementsPerWorker ) { await this.startWorker();