X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fworker%2FWorkerAbstract.ts;h=a18a085e5e0a37a58b3b31127976005f3fe4f9be;hb=107efcc6655b5a4409fc5db3da90869d6881a195;hp=6a8a0a0ff07dc9003816ea6f76ef9e356d22a1de;hpb=fd1fdf1b7bd53ee19679eb9c7d83b2592c32aed7;p=e-mobility-charging-stations-simulator.git diff --git a/src/worker/WorkerAbstract.ts b/src/worker/WorkerAbstract.ts index 6a8a0a0f..a18a085e 100644 --- a/src/worker/WorkerAbstract.ts +++ b/src/worker/WorkerAbstract.ts @@ -1,17 +1,21 @@ +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; + public abstract maxElementsPerWorker: number | null; /** - * Create a new `Worker` implementation. + * `WorkerAbstract` constructor. * - * @param {string} workerScript + * @param workerScript + * @param workerStartDelay */ - constructor(workerScript: string) { + constructor(workerScript: string, workerStartDelay: number = Constants.WORKER_START_DELAY) { this.workerScript = workerScript; + this.workerStartDelay = workerStartDelay; } public abstract start(): Promise;