Fix ATG start blocking call
authorJérôme Benoit <jerome.benoit@sap.com>
Sun, 2 May 2021 19:16:23 +0000 (21:16 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Sun, 2 May 2021 19:16:23 +0000 (21:16 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/AutomaticTransactionGenerator.ts
src/charging-station/ChargingStation.ts

index bb8d75b3ecaacbc06095c73e8216f395915b231e..e675550f348d2f4fddf87cdffd49df634321672d 100644 (file)
@@ -53,7 +53,7 @@ export default class AutomaticTransactionGenerator {
     this.timeToStop = true;
   }
 
-  public async startConnector(connectorId: number): Promise<void> {
+  private async startConnector(connectorId: number): Promise<void> {
     do {
       if (this.timeToStop) {
         logger.error(this.logPrefix(connectorId) + ' Entered in transaction loop while a request to stop it was made');
index 44327562d69274da428066f7a58f0106a668ec2b..6bff621fec5b50ead39cba724edf97f029a985d4 100644 (file)
@@ -728,7 +728,8 @@ export default class ChargingStation {
         this.automaticTransactionGeneration = new AutomaticTransactionGenerator(this);
       }
       if (this.automaticTransactionGeneration.timeToStop) {
-        await this.automaticTransactionGeneration.start();
+        // The ATG might sleep
+        void this.automaticTransactionGeneration.start();
       }
     }
     if (this.getEnableStatistics()) {
@@ -865,7 +866,8 @@ export default class ChargingStation {
             this.automaticTransactionGeneration = new AutomaticTransactionGenerator(this);
           }
           if (this.automaticTransactionGeneration.timeToStop) {
-            await this.automaticTransactionGeneration.start();
+            // The ATG might sleep
+            void this.automaticTransactionGeneration.start();
           }
         }
         // FIXME?: restart heartbeat and WebSocket ping when their interval values have changed