X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fworker%2FWorkerStaticPool.ts;h=ab8e309f208f4655ff0ba6acb96929fea12c8d3d;hb=ce4d00ee7295ccdb12f35154eb2eb72973b6e75b;hp=3a144c35ac7fa5464db448967a83beafaa0c462e;hpb=c32882b0f88f2025112eabdeaecbb56d0fb92ca4;p=e-mobility-charging-stations-simulator.git diff --git a/src/worker/WorkerStaticPool.ts b/src/worker/WorkerStaticPool.ts index 3a144c35..ab8e309f 100644 --- a/src/worker/WorkerStaticPool.ts +++ b/src/worker/WorkerStaticPool.ts @@ -3,10 +3,10 @@ import { FixedThreadPool, PoolOptions } from 'poolifier'; import Constants from '../utils/Constants'; import Utils from '../utils/Utils'; import { Worker } from 'worker_threads'; +import WorkerAbstract from './WorkerAbstract'; import { WorkerData } from '../types/Worker'; -import Wrk from './Wrk'; -export default class WorkerStaticPool extends Wrk { +export default class WorkerStaticPool extends WorkerAbstract { private pool: StaticPool; /** @@ -14,9 +14,9 @@ export default class WorkerStaticPool extends Wrk { * * @param {string} workerScript */ - constructor(workerScript: string, numThreads: number) { + constructor(workerScript: string, numberOfThreads: number) { super(workerScript); - this.pool = StaticPool.getInstance(numThreads, this.workerScript); + this.pool = StaticPool.getInstance(numberOfThreads, this.workerScript); } get size(): number { @@ -24,7 +24,7 @@ export default class WorkerStaticPool extends Wrk { } get maxElementsPerWorker(): number { - return 1; + return null; } /** @@ -59,13 +59,13 @@ export default class WorkerStaticPool extends Wrk { class StaticPool extends FixedThreadPool { private static instance: StaticPool; - private constructor(numThreads: number, workerScript: string, opts?: PoolOptions) { - super(numThreads, workerScript, opts); + private constructor(numberOfThreads: number, workerScript: string, opts?: PoolOptions) { + super(numberOfThreads, workerScript, opts); } - public static getInstance(numThreads: number, workerScript: string): StaticPool { + public static getInstance(numberOfThreads: number, workerScript: string): StaticPool { if (!StaticPool.instance) { - StaticPool.instance = new StaticPool(numThreads, workerScript, + StaticPool.instance = new StaticPool(numberOfThreads, workerScript, { exitHandler: (code) => { if (code !== 0) {