X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fworker%2FWorkerAbstract.ts;h=fa28597c55784d585fcec7231f0aea69e298bee1;hb=2f79b4478e28ed922581029adf341210da6149b4;hp=6a8a0a0ff07dc9003816ea6f76ef9e356d22a1de;hpb=95250e1b3f40c916420bb693502fda4b0e49ac33;p=e-mobility-charging-stations-simulator.git diff --git a/src/worker/WorkerAbstract.ts b/src/worker/WorkerAbstract.ts index 6a8a0a0f..fa28597c 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; - public abstract size: number; - public abstract maxElementsPerWorker: number; + protected readonly workerScript: string; + protected readonly workerStartDelay: number; + public abstract readonly size: number; + public abstract readonly 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;