Disable performance statistics by default
authorJérôme Benoit <jerome.benoit@sap.com>
Sun, 8 Jan 2023 23:34:26 +0000 (00:34 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Sun, 8 Jan 2023 23:34:26 +0000 (00:34 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/ChargingStation.ts

index 806bcd752cd50a2cfdc8408e8b9147e48fcaa81a..8d7907bad7c111968344a10502dd7df1224133a6 100644 (file)
@@ -173,17 +173,15 @@ export default class ChargingStation {
     );
   }
 
-  public getEnableStatistics(): boolean | undefined {
-    return !Utils.isUndefined(this.stationInfo.enableStatistics)
-      ? this.stationInfo.enableStatistics
-      : true;
+  public getEnableStatistics(): boolean {
+    return this.stationInfo.enableStatistics ?? false;
   }
 
-  public getMustAuthorizeAtRemoteStart(): boolean | undefined {
+  public getMustAuthorizeAtRemoteStart(): boolean {
     return this.stationInfo.mustAuthorizeAtRemoteStart ?? true;
   }
 
-  public getPayloadSchemaValidation(): boolean | undefined {
+  public getPayloadSchemaValidation(): boolean {
     return this.stationInfo.payloadSchemaValidation ?? true;
   }
 
@@ -487,7 +485,7 @@ export default class ChargingStation {
     if (this.started === false) {
       if (this.starting === false) {
         this.starting = true;
-        if (this.getEnableStatistics()) {
+        if (this.getEnableStatistics() === true) {
           this.performanceStatistics.start();
         }
         this.openWSConnection();
@@ -515,7 +513,7 @@ export default class ChargingStation {
                 ) {
                   this.startAutomaticTransactionGenerator();
                 }
-                if (this.getEnableStatistics()) {
+                if (this.getEnableStatistics() === true) {
                   this.performanceStatistics.restart();
                 } else {
                   this.performanceStatistics.stop();
@@ -547,7 +545,7 @@ export default class ChargingStation {
         this.stopping = true;
         await this.stopMessageSequence(reason);
         this.closeWSConnection();
-        if (this.getEnableStatistics()) {
+        if (this.getEnableStatistics() === true) {
           this.performanceStatistics.stop();
         }
         this.sharedLRUCache.deleteChargingStationConfiguration(this.configurationFileHash);
@@ -961,7 +959,7 @@ export default class ChargingStation {
     // Avoid duplication of connectors related information in RAM
     this.stationInfo?.Connectors && delete this.stationInfo.Connectors;
     this.configuredSupervisionUrl = this.getConfiguredSupervisionUrl();
-    if (this.getEnableStatistics()) {
+    if (this.getEnableStatistics() === true) {
       this.performanceStatistics = PerformanceStatistics.getInstance(
         this.stationInfo.hashId,
         this.stationInfo.chargingStationId,