From 6ccd865d6381ce21115dbe4c9271f64e5c8048c5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Mon, 20 Nov 2023 23:15:40 +0100 Subject: [PATCH] fix: ensure the message buffer is flushed once accepted state is reached MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/charging-station/ChargingStation.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index 0ab700a5..e354b4b5 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -183,7 +183,6 @@ export class ChargingStation extends EventEmitter { private ocppIncomingRequestService!: OCPPIncomingRequestService; private readonly messageBuffer: Set; private configuredSupervisionUrl!: URL; - private wsConnectionRestarted: boolean; private autoReconnectRetryCount: number; private templateFileWatcher!: FSWatcher | undefined; private templateFileHash!: string; @@ -198,7 +197,6 @@ export class ChargingStation extends EventEmitter { this.starting = false; this.stopping = false; this.wsConnection = null; - this.wsConnectionRestarted = false; this.autoReconnectRetryCount = 0; this.index = index; this.templateFile = templateFile; @@ -1789,7 +1787,6 @@ export class ChargingStation extends EventEmitter { .stationInfo?.registrationMaxRetries})`, ); } - this.wsConnectionRestarted = false; this.autoReconnectRetryCount = 0; this.emit(ChargingStationEvents.updated); } else { @@ -2157,7 +2154,7 @@ export class ChargingStation extends EventEmitter { if (this.getAutomaticTransactionGeneratorConfiguration().enable === true) { this.startAutomaticTransactionGenerator(); } - this.wsConnectionRestarted === true && this.flushMessageBuffer(); + this.flushMessageBuffer(); } private async stopMessageSequence( @@ -2345,7 +2342,6 @@ export class ChargingStation extends EventEmitter { }, { closeOpened: true }, ); - this.wsConnectionRestarted = true; } else if (this.stationInfo?.autoReconnectMaxRetries !== -1) { logger.error( `${this.logPrefix()} WebSocket connection retries failure: maximum retries reached (${ -- 2.34.1