Make some Wrk attributes conditionally initialized.
authorJérôme Benoit <jerome.benoit@sap.com>
Sat, 23 Jan 2021 06:55:53 +0000 (07:55 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Sat, 23 Jan 2021 06:55:53 +0000 (07:55 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/Worker.ts

index 824a304b8b43e17e75cb95271ed8b2d365273ca3..8a9e9f91198b1d70f3b9fd7246097bdd9678ca7a 100644 (file)
@@ -5,7 +5,6 @@ import WorkerData from '../types/WorkerData';
 import WorkerPool from './WorkerPool';
 
 export default class Wrk {
-  private static wrkInstances: Wrk[];
   private workerScript: string;
   private workerData: WorkerData;
   private worker: Worker;
@@ -22,10 +21,11 @@ export default class Wrk {
   constructor(workerScript: string, workerData: WorkerData, maxWorkerElements = 1) {
     this.workerData = workerData;
     this.workerScript = workerScript;
-    this.maxWorkerElements = maxWorkerElements;
-    this.numWorkerElements = 0;
     if (Configuration.useWorkerPool()) {
       WorkerPool.maxConcurrentWorkers = Configuration.getWorkerPoolMaxSize();
+    } else {
+      this.maxWorkerElements = maxWorkerElements;
+      this.numWorkerElements = 0;
     }
   }