]> Piment Noir Git Repositories - e-mobility-charging-stations-simulator.git/commitdiff
fix: ensure buffered messages flushing is stopped when WS is closed
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Wed, 30 Apr 2025 10:21:07 +0000 (12:21 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Wed, 30 Apr 2025 10:21:07 +0000 (12:21 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
src/charging-station/ChargingStation.ts

index bbf89bea5860b97c5a7f426117a941fdbbc68591..89f731451b2044df9f14c6c49a7c1dc7b987a795 100644 (file)
@@ -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)