]> Piment Noir Git Repositories - e-mobility-charging-stations-simulator.git/commit
fix(ocpp): use per-subclass singleton map to prevent version collision
authorJérôme Benoit <jerome.benoit@sap.com>
Sun, 15 Mar 2026 22:37:22 +0000 (23:37 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Sun, 15 Mar 2026 22:37:22 +0000 (23:37 +0100)
commit3de193f999a0750fac951e09682e860c68d88c5a
treeb417c901fadf27ed3e56e24919a51be51d7e4bce
parentadfe8d486791632d1e03b9ff58be02ba4fa4c9da
fix(ocpp): use per-subclass singleton map to prevent version collision

The singleton instance was stored as a single static field on the base
class. In mixed OCPP 1.6/2.0 workers, the first getInstance() call
wins — subsequent calls for a different version silently return the
wrong instance cast via 'as T'.

Replace with Map<Constructor, Instance> keyed by the concrete subclass
constructor. Each version now gets its own singleton entry. Zero
changes needed in subclasses or calling code.
src/charging-station/ocpp/OCPPIncomingRequestService.ts
src/charging-station/ocpp/OCPPRequestService.ts
src/charging-station/ocpp/OCPPResponseService.ts