X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2FBootstrap.ts;h=bb101ca7b75bf3f79153770a0d0dce82ef51d494;hb=322c9192eaa7142da1bf475cc2c6588ca72d922c;hp=503c6bd2401f3a530a0e02fa55bc3239d1d3ade6;hpb=8bbe7426a07c159108c9cb1f69d3fe6b5cef5fe9;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/Bootstrap.ts b/src/charging-station/Bootstrap.ts index 503c6bd2..bb101ca7 100644 --- a/src/charging-station/Bootstrap.ts +++ b/src/charging-station/Bootstrap.ts @@ -64,11 +64,9 @@ export default class Bootstrap { public async stop(): Promise { if (isMainThread && this.started) { - if (this.getWorkerImplementationInstance()) { - await this.getWorkerImplementationInstance().stop(); - // Nullify to force worker implementation instance creation - this.workerImplementationInstance = null; - } + await this.getWorkerImplementationInstance().stop(); + // Nullify to force worker implementation instance creation + this.workerImplementationInstance = null; } this.started = false; } @@ -80,11 +78,13 @@ export default class Bootstrap { private getWorkerImplementationInstance(): WorkerAbstract { if (!this.workerImplementationInstance) { - this.workerImplementationInstance = WorkerFactory.getWorkerImplementation(this.workerScript, Configuration.getWorkerProcess(), { - poolMaxSize: Configuration.getWorkerPoolMaxSize(), - poolMinSize: Configuration.getWorkerPoolMinSize(), - elementsPerWorker: Configuration.getChargingStationsPerWorker() - }); + this.workerImplementationInstance = WorkerFactory.getWorkerImplementation(this.workerScript, Configuration.getWorkerProcess(), + { + startDelay: Configuration.getWorkerStartDelay(), + poolMaxSize: Configuration.getWorkerPoolMaxSize(), + poolMinSize: Configuration.getWorkerPoolMinSize(), + elementsPerWorker: Configuration.getChargingStationsPerWorker() + }); } return this.workerImplementationInstance; }