From: Jérôme Benoit Date: Mon, 7 Aug 2023 17:30:07 +0000 (+0200) Subject: fix: fix configuration section cache usage X-Git-Tag: v1.2.20~9 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=eb979012a7cf774edbaff7bff6da3e941024d3ad;p=e-mobility-charging-stations-simulator.git fix: fix configuration section cache usage Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index f92ea2b6..4ca577af 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -1585,11 +1585,11 @@ export class ChargingStation { this.evsesConfigurationHash = evsesConfigHash; const templateMaxEvses = getMaxNumberOfEvses(stationTemplate?.Evses); if (templateMaxEvses > 0) { - for (const evse in stationTemplate.Evses) { - const evseId = convertToInt(evse); + for (const evseKey in stationTemplate.Evses) { + const evseId = convertToInt(evseKey); this.evses.set(evseId, { connectors: buildConnectorsMap( - stationTemplate?.Evses[evse]?.Connectors, + stationTemplate?.Evses[evseKey]?.Connectors, this.logPrefix(), this.templateFile, ), diff --git a/src/utils/Configuration.ts b/src/utils/Configuration.ts index b564cd62..6d7c4a81 100644 --- a/src/utils/Configuration.ts +++ b/src/utils/Configuration.ts @@ -161,12 +161,16 @@ export class Configuration { public static workerPoolInUse(): boolean { return [WorkerProcessType.dynamicPool, WorkerProcessType.staticPool].includes( - Configuration.buildWorkerSection().processType!, + Configuration.getConfigurationSection(ConfigurationSection.worker) + .processType!, ); } public static workerDynamicPoolInUse(): boolean { - return Configuration.buildWorkerSection().processType === WorkerProcessType.dynamicPool; + return ( + Configuration.getConfigurationSection(ConfigurationSection.worker) + .processType === WorkerProcessType.dynamicPool + ); } private static isConfigurationSectionCached(sectionName: ConfigurationSection): boolean {