From b44b779aaacf1b01e144244eaeeba472ec57aa71 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Tue, 30 Aug 2022 22:06:36 +0200 Subject: [PATCH] Fix charging station initialization order MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/charging-station/ChargingStation.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) 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(); -- 2.34.1