Apply dependencies update
[e-mobility-charging-stations-simulator.git] / src / worker / WorkerAbstract.ts
index 6a8a0a0ff07dc9003816ea6f76ef9e356d22a1de..fa28597c55784d585fcec7231f0aea69e298bee1 100644 (file)
@@ -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<void>;