From: Jérôme Benoit Date: Thu, 2 Feb 2023 22:13:54 +0000 (+0100) Subject: refactor(simulator): remove unneeded intermediate variables in startup X-Git-Tag: v1.1.93~17 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=6ed3c84506348f5a7eb6c14e4b0c359b8780f471;p=e-mobility-charging-stations-simulator.git refactor(simulator): remove unneeded intermediate variables in startup code Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/Bootstrap.ts b/src/charging-station/Bootstrap.ts index bf89016d..5c56c5dd 100644 --- a/src/charging-station/Bootstrap.ts +++ b/src/charging-station/Bootstrap.ts @@ -88,9 +88,8 @@ export class Bootstrap { await this.workerImplementation?.start(); await this.storage?.open(); this.uiServer?.start(); - const stationTemplateUrls = Configuration.getStationTemplateUrls(); // Start ChargingStation object instance in worker thread - for (const stationTemplateUrl of stationTemplateUrls) { + for (const stationTemplateUrl of Configuration.getStationTemplateUrls()) { try { const nbStations = stationTemplateUrl.numberOfStations ?? 0; for (let index = 1; index <= nbStations; index++) { @@ -284,7 +283,7 @@ export class Bootstrap { index: number, stationTemplateUrl: StationTemplateUrl ): Promise { - const workerData: ChargingStationWorkerData = { + await this.workerImplementation?.addElement({ index, templateFile: path.join( path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../'), @@ -292,8 +291,7 @@ export class Bootstrap { 'station-templates', stationTemplateUrl.file ), - }; - await this.workerImplementation?.addElement(workerData); + }); } private logPrefix = (): string => {