ATG: fix start transaction requests counting
[e-mobility-charging-stations-simulator.git] / src / charging-station / ocpp / OCPPRequestService.ts
index e00e2b99f9a2bbbddbdca10a6ae1427ffe982d2c..e78ca0c6dfa4d8fcec3049d05b67a11d62df82de 100644 (file)
@@ -1,5 +1,3 @@
-import { parentPort } from 'worker_threads';
-
 import type { JSONSchemaType } from 'ajv';
 import Ajv from 'ajv-draft-04';
 import ajvFormats from 'ajv-formats';
@@ -23,7 +21,6 @@ import Constants from '../../utils/Constants';
 import logger from '../../utils/Logger';
 import Utils from '../../utils/Utils';
 import type ChargingStation from '../ChargingStation';
-import { MessageChannelUtils } from '../MessageChannelUtils';
 import type OCPPResponseService from './OCPPResponseService';
 import { OCPPServiceUtils } from './OCPPServiceUtils';
 
@@ -254,7 +251,6 @@ export default abstract class OCPPRequestService {
               reject(error);
             } finally {
               chargingStation.requests.delete(messageId);
-              // parentPort.postMessage(MessageChannelUtils.buildUpdatedMessage(chargingStation));
             }
           }
 
@@ -265,7 +261,7 @@ export default abstract class OCPPRequestService {
            * @param requestStatistic
            */
           function errorCallback(error: OCPPError, requestStatistic = true): void {
-            if (requestStatistic && chargingStation.getEnableStatistics()) {
+            if (requestStatistic === true && chargingStation.getEnableStatistics() === true) {
               chargingStation.performanceStatistics.addRequestStatistic(
                 commandName,
                 MessageType.CALL_ERROR_MESSAGE
@@ -278,7 +274,6 @@ export default abstract class OCPPRequestService {
               error
             );
             chargingStation.requests.delete(messageId);
-            // parentPort.postMessage(MessageChannelUtils.buildUpdatedMessage(chargingStation));
             reject(error);
           }
         }),
@@ -366,7 +361,7 @@ export default abstract class OCPPRequestService {
     error: Error,
     params: HandleErrorParams<EmptyObject> = { throwError: true }
   ): void {
-    logger.error(`${chargingStation.logPrefix()} Request command ${commandName} error:`, error);
+    logger.error(`${chargingStation.logPrefix()} Request command '${commandName}' error:`, error);
     if (params?.throwError) {
       throw error;
     }