feat: add message buffer flush interval
[e-mobility-charging-stations-simulator.git] / src / charging-station / Bootstrap.ts
index 88c516bddeb527be0c11cf03ac8902c3e16fda87..003b093a3579c02d094addc7f2210e88d14f789b 100644 (file)
@@ -215,11 +215,11 @@ export class Bootstrap extends EventEmitter {
     return new Promise<string>((resolve, reject) => {
       const waitTimeout = setTimeout(() => {
         const message = `Timeout ${formatDurationMilliSeconds(
-          Constants.STOP_SIMULATOR_TIMEOUT,
+          Constants.STOP_CHARGING_STATIONS_TIMEOUT,
         )} reached at stopping charging stations`;
         console.warn(chalk.yellow(message));
         reject(new Error(message));
-      }, Constants.STOP_SIMULATOR_TIMEOUT);
+      }, Constants.STOP_CHARGING_STATIONS_TIMEOUT);
       waitChargingStationEvents(
         this,
         ChargingStationWorkerMessageEvents.stopped,
@@ -228,9 +228,7 @@ export class Bootstrap extends EventEmitter {
         .then(() => {
           resolve('Charging stations stopped');
         })
-        .catch((error) => {
-          reject(error);
-        })
+        .catch(reject)
         .finally(() => {
           clearTimeout(waitTimeout);
         });