From: Jérôme Benoit Date: Sun, 4 Feb 2024 11:51:42 +0000 (+0100) Subject: refactor: ensure ATG will not start a transaction if one is already X-Git-Tag: v1.2.35~19 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=9022112bdd8f1da4c4e6812d0b036e3830b32b65;p=e-mobility-charging-stations-simulator.git refactor: ensure ATG will not start a transaction if one is already started Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/AutomaticTransactionGenerator.ts b/src/charging-station/AutomaticTransactionGenerator.ts index adf38e67..37c9b631 100644 --- a/src/charging-station/AutomaticTransactionGenerator.ts +++ b/src/charging-station/AutomaticTransactionGenerator.ts @@ -324,6 +324,15 @@ export class AutomaticTransactionGenerator { ) return false } + const connectorStatus = this.chargingStation.getConnectorStatus(connectorId) + if (connectorStatus?.transactionStarted === true) { + logger.info( + `${this.logPrefix( + connectorId + )} entered in transaction loop while a transaction ${connectorStatus.transactionId} is already started on connector ${connectorId}` + ) + return false + } return true } @@ -365,7 +374,7 @@ export class AutomaticTransactionGenerator { logger.info( `${this.logPrefix( connectorId - )} transaction loop waiting for running transaction ${connectorStatus.transactionId} on connector ${connectorId} to be stopped` + )} transaction loop waiting for started transaction ${connectorStatus.transactionId} on connector ${connectorId} to be stopped` ) logged = true }