From 9022112bdd8f1da4c4e6812d0b036e3830b32b65 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sun, 4 Feb 2024 12:51:42 +0100 Subject: [PATCH] refactor: ensure ATG will not start a transaction if one is already started MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/charging-station/AutomaticTransactionGenerator.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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 } -- 2.34.1