From 326cec2dcb1662396a9557ba8ae1c74ea523baed Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Thu, 2 Feb 2023 21:04:09 +0100 Subject: [PATCH] fix(simulator): initialize charging station worker outside the constructor MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/charging-station/Bootstrap.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/charging-station/Bootstrap.ts b/src/charging-station/Bootstrap.ts index 113a9f1d..2bf71595 100644 --- a/src/charging-station/Bootstrap.ts +++ b/src/charging-station/Bootstrap.ts @@ -56,7 +56,7 @@ export class Bootstrap { 'charging-station', `ChargingStationWorker${path.extname(fileURLToPath(import.meta.url))}` ); - this.initialize(); + this.initializeCounters(); Configuration.getUIServer().enabled === true && (this.uiServer = UIServerFactory.getUIServerImplementation(Configuration.getUIServer())); Configuration.getPerformanceStorage().enabled === true && @@ -81,7 +81,8 @@ export class Bootstrap { // Enable unconditionally for now this.logUnhandledRejection(); this.logUncaughtException(); - this.initialize(); + this.initializeCounters(); + this.initializeWorkerImplementation(); await this.storage?.open(); await this.workerImplementation?.start(); this.uiServer?.start(); @@ -144,7 +145,8 @@ export class Bootstrap { public async restart(): Promise { await this.stop(); - this.initialize(); + this.initializeCounters(); + this.initializeWorkerImplementation(); await this.start(); } @@ -238,7 +240,7 @@ export class Bootstrap { this.storage.storePerformanceStatistics(data) as void; }; - private initialize() { + private initializeCounters() { this.numberOfChargingStationTemplates = 0; this.numberOfChargingStations = 0; const stationTemplateUrls = Configuration.getStationTemplateUrls(); @@ -258,7 +260,6 @@ export class Bootstrap { process.exit(exitCodes.noChargingStationTemplates); } this.numberOfStartedChargingStations = 0; - this.initializeWorkerImplementation(); } private logUncaughtException(): void { -- 2.34.1