X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fcharging-station%2FBootstrap.ts;h=7a823e56f3ed7f253db079fbf8482d188528ecf4;hb=af8e02ca9a957f78366251dd2e2b818c7b398dd4;hp=113a9f1dae77e389a79a88b8367a5349088f8f7c;hpb=846d285145c208d251fedf80426c7a4abf12d731;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/Bootstrap.ts b/src/charging-station/Bootstrap.ts index 113a9f1d..7a823e56 100644 --- a/src/charging-station/Bootstrap.ts +++ b/src/charging-station/Bootstrap.ts @@ -49,6 +49,9 @@ export class Bootstrap { private readonly workerScript: string; private constructor() { + // Enable unconditionally for now + this.logUnhandledRejection(); + this.logUncaughtException(); this.started = false; this.workerImplementation = null; this.workerScript = path.join( @@ -56,7 +59,6 @@ export class Bootstrap { 'charging-station', `ChargingStationWorker${path.extname(fileURLToPath(import.meta.url))}` ); - this.initialize(); Configuration.getUIServer().enabled === true && (this.uiServer = UIServerFactory.getUIServerImplementation(Configuration.getUIServer())); Configuration.getPerformanceStorage().enabled === true && @@ -78,10 +80,8 @@ export class Bootstrap { public async start(): Promise { if (isMainThread && this.started === false) { try { - // 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 +144,6 @@ export class Bootstrap { public async restart(): Promise { await this.stop(); - this.initialize(); await this.start(); } @@ -238,7 +237,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 +257,6 @@ export class Bootstrap { process.exit(exitCodes.noChargingStationTemplates); } this.numberOfStartedChargingStations = 0; - this.initializeWorkerImplementation(); } private logUncaughtException(): void {