]> Piment Noir Git Repositories - e-mobility-charging-stations-simulator.git/commit
refactor(ocpp20): isolate per-station state with WeakMap instead of singleton properties
authorJérôme Benoit <jerome.benoit@sap.com>
Sun, 15 Mar 2026 18:04:39 +0000 (19:04 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Sun, 15 Mar 2026 18:04:39 +0000 (19:04 +0100)
commit47cdf2bbee7d500ae063beed7d68344298b1057f
treee1f9c4f2264e1413eaca2bd6cede00d192d4ea32
parent91cfffa6f24609bf6f061952c94ae42c6233c9db
refactor(ocpp20): isolate per-station state with WeakMap instead of singleton properties

Per-station state (firmware update tracking, report cache, connector status
backup) was incorrectly stored as flat properties on the singleton
OCPP20IncomingRequestService, causing cross-station pollution when multiple
stations share the same service instance.

Introduce OCPP20PerStationState interface and a WeakMap<ChargingStation, ...>
to properly isolate state per station, matching the stateless service pattern
used by OCPP16IncomingRequestService. State is lazily initialized and
automatically garbage collected when the station is released.
src/charging-station/ocpp/2.0/OCPP20IncomingRequestService.ts