From 6ed3c84506348f5a7eb6c14e4b0c359b8780f471 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Thu, 2 Feb 2023 23:13:54 +0100 Subject: [PATCH] refactor(simulator): remove unneeded intermediate variables in startup code 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 | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) 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 => { -- 2.34.1