From a01134ed215b62a0c82475b9fbb35306fa792bbc Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Thu, 4 Jan 2024 14:42:10 +0100 Subject: [PATCH] fix: ensure graceful shutdown waits only for started stations stopping MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/charging-station/Bootstrap.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/charging-station/Bootstrap.ts b/src/charging-station/Bootstrap.ts index 3993437b..22b3207b 100644 --- a/src/charging-station/Bootstrap.ts +++ b/src/charging-station/Bootstrap.ts @@ -223,16 +223,16 @@ export class Bootstrap extends EventEmitter { private async waitChargingStationsStopped (): Promise { return await new Promise((resolve, reject) => { const waitTimeout = setTimeout(() => { - const message = `Timeout ${formatDurationMilliSeconds( + const timeoutMessage = `Timeout ${formatDurationMilliSeconds( Constants.STOP_CHARGING_STATIONS_TIMEOUT )} reached at stopping charging stations` - console.warn(chalk.yellow(message)) - reject(new Error(message)) + console.warn(chalk.yellow(timeoutMessage)) + reject(new Error(timeoutMessage)) }, Constants.STOP_CHARGING_STATIONS_TIMEOUT) waitChargingStationEvents( this, ChargingStationWorkerMessageEvents.stopped, - this.numberOfChargingStations + this.numberOfStartedChargingStations ) .then(() => { resolve('Charging stations stopped') -- 2.34.1