fix: fix configuration section cache usage
authorJérôme Benoit <jerome.benoit@sap.com>
Mon, 7 Aug 2023 17:30:07 +0000 (19:30 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Mon, 7 Aug 2023 17:30:07 +0000 (19:30 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/ChargingStation.ts
src/utils/Configuration.ts

index f92ea2b6e96863c01ecca86ecaa91891592073be..4ca577aff1d1cc9895bd899c0c7304aa2bcdedf6 100644 (file)
@@ -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,
               ),
index b564cd6252ea4366993f24bb5e9961132bd9ad4d..6d7c4a81b9a7f10a1e2fcc489aa9b61846b33012 100644 (file)
@@ -161,12 +161,16 @@ export class Configuration {
 
   public static workerPoolInUse(): boolean {
     return [WorkerProcessType.dynamicPool, WorkerProcessType.staticPool].includes(
-      Configuration.buildWorkerSection().processType!,
+      Configuration.getConfigurationSection<WorkerConfiguration>(ConfigurationSection.worker)
+        .processType!,
     );
   }
 
   public static workerDynamicPoolInUse(): boolean {
-    return Configuration.buildWorkerSection().processType === WorkerProcessType.dynamicPool;
+    return (
+      Configuration.getConfigurationSection<WorkerConfiguration>(ConfigurationSection.worker)
+        .processType === WorkerProcessType.dynamicPool
+    );
   }
 
   private static isConfigurationSectionCached(sectionName: ConfigurationSection): boolean {