X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2FChargingStation.ts;h=996b9cf9fb6a83694c8b1fbf1eea80f7d9aed7b4;hb=f6591eb9f063490a9b4950ff782c1026281e81bc;hp=c6a5278edccc1b5f9e324fff5584f32c3e042fde;hpb=1f7173559059235505c4cca840d2c92a5b2daa6e;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index c6a5278e..996b9cf9 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -682,7 +682,7 @@ export class ChargingStation { this.initialize(); this.idTagsCache.deleteIdTags(getIdTagsFile(this.stationInfo)!); // Restart the ATG - this.stopAutomaticTransactionGenerator(); + this.stopAutomaticTransactionGenerator().catch(() => {}); delete this.automaticTransactionGeneratorConfiguration; if (this.getAutomaticTransactionGeneratorConfiguration()?.enable === true) { this.startAutomaticTransactionGenerator(); @@ -873,13 +873,13 @@ export class ChargingStation { parentPort?.postMessage(buildUpdatedMessage(this)); } - public stopAutomaticTransactionGenerator(connectorIds?: number[]): void { + public async stopAutomaticTransactionGenerator(connectorIds?: number[]): Promise { if (isNotEmptyArray(connectorIds)) { for (const connectorId of connectorIds!) { - this.automaticTransactionGenerator?.stopConnector(connectorId); + await this.automaticTransactionGenerator?.stopConnector(connectorId); } } else { - this.automaticTransactionGenerator?.stop(); + await this.automaticTransactionGenerator?.stop(); } this.saveAutomaticTransactionGeneratorConfiguration(); parentPort?.postMessage(buildUpdatedMessage(this)); @@ -2171,7 +2171,7 @@ export class ChargingStation { this.stopHeartbeat(); // Stop ongoing transactions if (this.automaticTransactionGenerator?.started === true) { - this.stopAutomaticTransactionGenerator(); + await this.stopAutomaticTransactionGenerator(); } else { await this.stopRunningTransactions(reason); } @@ -2318,7 +2318,7 @@ export class ChargingStation { this.stopHeartbeat(); // Stop the ATG if needed if (this.getAutomaticTransactionGeneratorConfiguration().stopOnConnectionFailure === true) { - this.stopAutomaticTransactionGenerator(); + await this.stopAutomaticTransactionGenerator(); } if ( this.autoReconnectRetryCount < this.getAutoReconnectMaxRetries()! ||