From: Jérôme Benoit Date: Sat, 23 Jan 2021 06:55:53 +0000 (+0100) Subject: Make some Wrk attributes conditionally initialized. X-Git-Tag: v1.0.1-0~122 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=c96c65446db22c81ae48714691dbf974a8141b1d;p=e-mobility-charging-stations-simulator.git Make some Wrk attributes conditionally initialized. Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/Worker.ts b/src/charging-station/Worker.ts index 824a304b..8a9e9f91 100644 --- a/src/charging-station/Worker.ts +++ b/src/charging-station/Worker.ts @@ -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; } }