X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fworker%2FWorkerAbstract.ts;h=772bf1b47cc59d3a2593ea8d6dc483f7f9f73832;hb=322c9192eaa7142da1bf475cc2c6588ca72d922c;hp=9f16af737457cf5daa522a1d25859514a6b6b3b1;hpb=99503026b3fc316b7743d55a7e5c1c814bc43499;p=e-mobility-charging-stations-simulator.git diff --git a/src/worker/WorkerAbstract.ts b/src/worker/WorkerAbstract.ts index 9f16af73..772bf1b4 100644 --- a/src/worker/WorkerAbstract.ts +++ b/src/worker/WorkerAbstract.ts @@ -1,7 +1,9 @@ +import Constants from '../utils/Constants'; import { WorkerData } from '../types/Worker'; export default abstract class WorkerAbstract { - protected workerScript: string; + protected readonly workerScript: string; + protected readonly workerStartDelay: number; public abstract size: number; public abstract maxElementsPerWorker: number; @@ -9,9 +11,11 @@ export default abstract class WorkerAbstract { * `WorkerAbstract` constructor. * * @param {string} workerScript + * @param {number} workerStartDelay */ - constructor(workerScript: string) { + constructor(workerScript: string, workerStartDelay: number = Constants.WORKER_START_DELAY) { this.workerScript = workerScript; + this.workerStartDelay = workerStartDelay; } public abstract start(): Promise;