From: Jérôme Benoit Date: Sun, 15 Mar 2026 18:23:00 +0000 (+0100) Subject: fix(ocpp20): clean up VariableManager mappings cache on station stop X-Git-Tag: ocpp-server@v3.1.0~18 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=7f1aee53bbb2987f21a679d46961fbac8637d4bb;p=e-mobility-charging-stations-simulator.git fix(ocpp20): clean up VariableManager mappings cache on station stop invalidateMappingsCache was never called on station stop, leaking invalidVariables and validatedStations entries for each stopped station. Call it alongside resetRuntimeOverrides in stop() for complete cleanup. --- diff --git a/src/charging-station/ocpp/2.0/OCPP20IncomingRequestService.ts b/src/charging-station/ocpp/2.0/OCPP20IncomingRequestService.ts index 3e2a783e..50ca5287 100644 --- a/src/charging-station/ocpp/2.0/OCPP20IncomingRequestService.ts +++ b/src/charging-station/ocpp/2.0/OCPP20IncomingRequestService.ts @@ -667,11 +667,14 @@ export class OCPP20IncomingRequestService extends OCPPIncomingRequestService { this.stationStates.delete(chargingStation) } try { - OCPP20VariableManager.getInstance().resetRuntimeOverrides(chargingStation.stationInfo?.hashId) - logger.debug(`${chargingStation.logPrefix()} ${moduleName}.stop: Runtime overrides cleared`) + const variableManager = OCPP20VariableManager.getInstance() + const stationId = chargingStation.stationInfo?.hashId + variableManager.resetRuntimeOverrides(stationId) + variableManager.invalidateMappingsCache(stationId) + logger.debug(`${chargingStation.logPrefix()} ${moduleName}.stop: Per-station state cleared`) } catch (error) { logger.error( - `${chargingStation.logPrefix()} ${moduleName}.stop: Error clearing runtime overrides:`, + `${chargingStation.logPrefix()} ${moduleName}.stop: Error clearing per-station state:`, error ) }