From: Jérôme Benoit Date: Tue, 30 Aug 2022 20:06:36 +0000 (+0200) Subject: Fix charging station initialization order X-Git-Tag: v1.1.69~7 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=b44b779aaacf1b01e144244eaeeba472ec57aa71;p=e-mobility-charging-stations-simulator.git Fix charging station initialization order Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index 66146be9..3129ae55 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -116,15 +116,15 @@ export default class ChargingStation { constructor(index: number, templateFile: string) { this.index = index; this.templateFile = templateFile; - this.stopped = false; - this.wsConnectionRestarted = false; - this.autoReconnectRetryCount = 0; - this.sharedLRUCache = SharedLRUCache.getInstance(); - this.authorizedTagsCache = AuthorizedTagsCache.getInstance(); this.connectors = new Map(); this.requests = new Map(); this.messageBuffer = new Set(); + this.sharedLRUCache = SharedLRUCache.getInstance(); + this.authorizedTagsCache = AuthorizedTagsCache.getInstance(); this.chargingStationWorkerBroadcastChannel = new ChargingStationWorkerBroadcastChannel(this); + this.stopped = false; + this.wsConnectionRestarted = false; + this.autoReconnectRetryCount = 0; this.initialize(); } @@ -950,13 +950,13 @@ export default class ChargingStation { } private initialize(): void { - this.stationInfo = this.getStationInfo(); - this.saveStationInfo(); - logger.info(`${this.logPrefix()} Charging station hashId '${this.stationInfo.hashId}'`); this.configurationFile = path.join( path.dirname(this.templateFile.replace('station-templates', 'configurations')), - this.stationInfo.hashId + '.json' + ChargingStationUtils.getHashId(this.index, this.getTemplateFromFile()) + '.json' ); + this.stationInfo = this.getStationInfo(); + this.saveStationInfo(); + logger.info(`${this.logPrefix()} Charging station hashId '${this.stationInfo.hashId}'`); // Avoid duplication of connectors related information in RAM this.stationInfo?.Connectors && delete this.stationInfo.Connectors; this.configuredSupervisionUrl = this.getConfiguredSupervisionUrl();