]> Piment Noir Git Repositories - e-mobility-charging-stations-simulator.git/commitdiff
fix(lifecycle): clear auth service on template reload and station reset
authorJérôme Benoit <jerome.benoit@sap.com>
Sat, 21 Mar 2026 19:26:19 +0000 (20:26 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Sat, 21 Mar 2026 19:26:19 +0000 (20:26 +0100)
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

src/charging-station/ChargingStation.ts

index 0764f6b9520be6bc2a2b9af6ce2eb0c1867fc389..a89f8c55dfa05beca83f71a8dddfb7ba4a347d7a 100644 (file)
@@ -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