perf: only clone the targeted connector status in ATG
authorJérôme Benoit <jerome.benoit@sap.com>
Mon, 31 Jul 2023 14:52:24 +0000 (16:52 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Mon, 31 Jul 2023 14:52:24 +0000 (16:52 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/AutomaticTransactionGenerator.ts

index dfab482ab2d63af90f06a7011e2e2bbf7ab5c205..1cf949d7545f4b970c438b4e2813349180767c19 100644 (file)
@@ -356,9 +356,9 @@ export class AutomaticTransactionGenerator extends AsyncResource {
     const connectorStatus = this.chargingStation.getAutomaticTransactionGeneratorStatuses()?.[
       connectorId
     ]
-      ? cloneObject<Status[]>(this.chargingStation.getAutomaticTransactionGeneratorStatuses()!)[
-          connectorId
-        ]
+      ? cloneObject<Status>(
+          this.chargingStation.getAutomaticTransactionGeneratorStatuses()![connectorId],
+        )
       : undefined;
     delete connectorStatus?.startDate;
     delete connectorStatus?.lastRunDate;