From: Jérôme Benoit Date: Sat, 21 Mar 2026 19:26:19 +0000 (+0100) Subject: fix(lifecycle): clear auth service on template reload and station reset X-Git-Tag: v3.2~10 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=3e8dea439e02e67a1a1ac32eb9da4ecff62ba24a;p=e-mobility-charging-stations-simulator.git fix(lifecycle): clear auth service on template reload and station reset Auth service instance was persisting across template reloads and station resets, causing stale adapters if OCPP version changed. - Add OCPPAuthServiceFactory.clearInstance() before initialize() in template file change handler - Add OCPPAuthServiceFactory.clearInstance() before initialize() in reset() method --- diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index 0764f6b9..a89f8c55 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -872,6 +872,7 @@ export class ChargingStation extends EventEmitter { } // eslint-disable-next-line @typescript-eslint/no-non-null-assertion await sleep(this.stationInfo!.resetTime!) + OCPPAuthServiceFactory.clearInstance(this) this.initialize() this.start() } @@ -935,6 +936,7 @@ export class ChargingStation extends EventEmitter { this.sharedLRUCache.deleteChargingStationTemplate(this.templateFileHash) // eslint-disable-next-line @typescript-eslint/no-non-null-assertion this.idTagsCache.deleteIdTags(getIdTagsFile(this.stationInfo!)!) + OCPPAuthServiceFactory.clearInstance(this) // Initialize this.initialize() // Restart the ATG