From: Jérôme Benoit Date: Mon, 20 Nov 2023 22:15:40 +0000 (+0100) Subject: fix: ensure the message buffer is flushed once accepted state is reached X-Git-Tag: v1.2.26~16 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=6ccd865d6381ce21115dbe4c9271f64e5c8048c5;p=e-mobility-charging-stations-simulator.git fix: ensure the message buffer is flushed once accepted state is reached Signed-off-by: Jérôme Benoit --- 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 (${