From: Jérôme Benoit Date: Wed, 30 Apr 2025 10:21:07 +0000 (+0200) Subject: fix: ensure buffered messages flushing is stopped when WS is closed X-Git-Tag: ocpp-server@v2.0.7~3 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=4e0e6536ce7de6a83e9343e6873d3054b58f2532;p=e-mobility-charging-stations-simulator.git fix: ensure buffered messages flushing is stopped when WS is closed Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index bbf89bea..89f73145 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -2332,7 +2332,7 @@ export class ChargingStation extends EventEmitter { if (this.isWebSocketConnectionOpened() && this.inAcceptedState()) { this.flushMessageBuffer() } - if (!this.flushingMessageBuffer && this.messageQueue.length === 0) { + if (!this.isWebSocketConnectionOpened() || this.messageQueue.length === 0) { this.clearIntervalFlushMessageBuffer() } }, Constants.DEFAULT_MESSAGE_BUFFER_FLUSH_INTERVAL)