- await this.uiServer?.sendInternalRequest(
- this.uiServer.buildProtocolRequest(
- generateUUID(),
- ProcedureName.STOP_CHARGING_STATION,
- Constants.EMPTY_FROZEN_OBJECT,
- ),
- );
- await Promise.race([
- waitChargingStationEvents(
- this,
- ChargingStationWorkerMessageEvents.stopped,
- this.numberOfChargingStations,
- ),
- new Promise<string>((resolve) => {
- setTimeout(() => {
- const message = `Timeout reached ${formatDurationMilliSeconds(
- Constants.STOP_SIMULATOR_TIMEOUT,
- )} at stopping charging stations simulator`;
- console.warn(chalk.yellow(message));
- resolve(message);
- }, Constants.STOP_SIMULATOR_TIMEOUT);
- }),
- ]);
+ if (stopChargingStations === true) {
+ await this.uiServer?.sendInternalRequest(
+ this.uiServer.buildProtocolRequest(
+ generateUUID(),
+ ProcedureName.STOP_CHARGING_STATION,
+ Constants.EMPTY_FROZEN_OBJECT,
+ ),
+ );
+ await this.waitChargingStationsStopped();
+ }