X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fworker%2FWorkerAbstract.ts;h=715778161af13b59bed90aa2805b0120451c64b8;hb=4e60c62f5c6218c73e650c33fa63708c8a516582;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..71577816 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 {number} workerStartDelay */ - constructor(workerScript: string) { + constructor(workerScript: string, workerStartDelay: number = Constants.WORKER_START_DELAY) { this.workerScript = workerScript; + this.workerStartDelay = workerStartDelay; } public abstract start(): Promise;