Cleanups.
authorJérôme Benoit <jerome.benoit@sap.com>
Fri, 5 Feb 2021 19:37:58 +0000 (20:37 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Fri, 5 Feb 2021 19:37:58 +0000 (20:37 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
package-lock.json
package.json
src/charging-station/Bootstrap.ts
src/charging-station/ChargingStation.ts

index 4a5aa11605ed19b10be30863fbddd67ba36c135c..d64f14ff2897e988a32b37a0f29983d103074936 100644 (file)
       "dev": true
     },
     "@types/node": {
-      "version": "14.14.22",
-      "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.22.tgz",
-      "integrity": "sha512-g+f/qj/cNcqKkc3tFqlXOYjrmZA+jNBiDzbP3kH+B+otKFqAdPgVTGP1IeKRdMml/aE69as5S4FqtxAbl+LaMw==",
+      "version": "14.14.25",
+      "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.25.tgz",
+      "integrity": "sha512-EPpXLOVqDvisVxtlbvzfyqSsFeQxltFbluZNRndIb8tr9KiBnYNLzrc1N3pyKUCww2RNrfHDViqDWWE1LCJQtQ==",
       "dev": true
     },
     "@types/offscreencanvas": {
index c59ab1981684dc0775dad0c5fcc9d82335691448..ed2067c5d88de673ff20cf8f71057b877332bb46 100644 (file)
@@ -61,7 +61,7 @@
     "utf-8-validate": "^5.0.4"
   },
   "devDependencies": {
-    "@types/node": "^14.14.22",
+    "@types/node": "^14.14.25",
     "@types/uuid": "^8.3.0",
     "@types/ws": "^7.4.0",
     "@typescript-eslint/eslint-plugin": "^4.14.2",
index 13fb957fc9a307523a1fa62c5e9356b7eb7d1ada..bf776f9e7bbc19b382fd57b7067464abcc00f919 100644 (file)
@@ -7,12 +7,12 @@ import { isMainThread } from 'worker_threads';
 
 export default class Bootstrap {
   private static instance: Bootstrap;
-  private isStarted: boolean;
+  private started: boolean;
   private workerScript: string;
   private workerImplementationInstance: Wrk;
 
   private constructor() {
-    this.isStarted = false;
+    this.started = false;
     this.workerScript = './dist/charging-station/StationWorker.js';
   }
 
@@ -24,7 +24,7 @@ export default class Bootstrap {
   }
 
   public async start(): Promise<void> {
-    if (isMainThread && !this.isStarted) {
+    if (isMainThread && !this.started) {
       try {
         let numStationsTotal = 0;
         await this.getWorkerImplementationInstance().start();
@@ -54,7 +54,7 @@ export default class Bootstrap {
         } else {
           console.log(`Charging station simulator started with ${numStationsTotal.toString()} charging station(s) and ${Utils.workerDynamicPoolInUse() ? `${Configuration.getWorkerPoolMinSize().toString()}/` : ''}${this.getWorkerImplementationInstance().size}${Utils.workerPoolInUse() ? `/${Configuration.getWorkerPoolMaxSize().toString()}` : ''} worker(s) concurrently running in '${Configuration.getWorkerProcess()}' mode (${this.getWorkerImplementationInstance().maxElementsPerWorker} charging station(s) per worker)`);
         }
-        this.isStarted = true;
+        this.started = true;
       } catch (error) {
       // eslint-disable-next-line no-console
         console.error('Bootstrap start error ', error);
@@ -63,14 +63,14 @@ export default class Bootstrap {
   }
 
   public async stop(): Promise<void> {
-    if (isMainThread && this.isStarted) {
+    if (isMainThread && this.started) {
       await this.getWorkerImplementationInstance().stop();
       if (this.getWorkerImplementationInstance()) {
         // Nullify to force worker implementation instance creation
         this.workerImplementationInstance = null;
       }
     }
-    this.isStarted = false;
+    this.started = false;
   }
 
   public async restart(): Promise<void> {
index 2d9e9a63ce2c2bf4bbca8cce9673f4b80ad229ba..f60fc79ecdd5d98f4f6d5ccb4399a6f9897af45c 100644 (file)
@@ -223,7 +223,7 @@ export default class ChargingStation {
         }
       }, interval);
     } else {
-      logger.error(`${this.logPrefix()} Charging station ${StandardParametersKey.MeterValueSampleInterval} configuration set to ${Utils.milliSecondsToHHMMSS(interval)}, not sending MeterValues`);
+      logger.error(`${this.logPrefix()} Charging station ${StandardParametersKey.MeterValueSampleInterval} configuration set to ${interval ? Utils.milliSecondsToHHMMSS(interval) : interval}, not sending MeterValues`);
     }
   }