X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fworker%2FWorkerSet.ts;h=956d97de0f07b54f0ce627f4620642205963de2a;hb=12b34061fc1777aae4fea0016899e74e6c3c5e70;hp=6e890902d8f8c769e726a262e5c013c39334b604;hpb=6fee1791db82bd4605b180612fe642a7e2c4caa0;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();