]> Piment Noir Git Repositories - e-mobility-charging-stations-simulator.git/commit
fix(charging-station): cancel a pending reset when the station is deleted (#2027...
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Sat, 18 Jul 2026 21:31:40 +0000 (23:31 +0200)
committerGitHub <noreply@github.com>
Sat, 18 Jul 2026 21:31:40 +0000 (23:31 +0200)
commit2b48cf8eabd989b2c7383b100d71c92fe0de5cac
treebb38802c1e40392d7f1e69b3f85e9d0ee5093ebe
parent1945ea3ad1d57170bceba8cfa211292c2e9c6128
fix(charging-station): cancel a pending reset when the station is deleted (#2027) (#2031)

reset() stopped the station, slept resetTime, then re-initialized and
reconnected without checking whether the station had been deleted during
the sleep. A station deleted mid-reset was resurrected and reconnected to
the CSMS (the "zombie" reconnect that triggers #2017).

Add an instance AbortController tripped by delete(); reset() now awaits
interruptibleSleep(resetTime, signal) and rechecks the aborted state
before re-initializing, bailing out cleanly on abort. The dispose signal
is kept distinct from started/stopping, which reset() itself toggles via
stop() and therefore cannot be used to detect deletion.

The OCPP Reset response stays Accepted and the handler still invokes
reset() fire-and-forget; only the reset/delete lifecycle changes.

Part B (element-granular worker-thread termination) remains open.
src/charging-station/ChargingStation.ts
tests/charging-station/ChargingStation-ResetCancellation.test.ts [new file with mode: 0644]