Add eslint-plugin-spellcheck (#139)
[poolifier.git] / src / pools / abstract-pool.ts
index 6b29669ff624a2ccdc58faebc2faa909125f97a0..b3198af3750252a738dca6b08d85da91ee94c599 100644 (file)
@@ -103,12 +103,12 @@ export abstract class AbstractPool<
   /**
    * Constructs a new poolifier pool.
    *
-   * @param numWorkers Number of workers that this pool should manage.
+   * @param numberOfWorkers Number of workers that this pool should manage.
    * @param filePath Path to the worker-file.
    * @param opts Options for the pool. Default: `{ maxTasks: 1000 }`
    */
   public constructor (
-    public readonly numWorkers: number,
+    public readonly numberOfWorkers: number,
     public readonly filePath: string,
     public readonly opts: PoolOptions<Worker> = { maxTasks: 1000 }
   ) {
@@ -122,7 +122,7 @@ export abstract class AbstractPool<
 
     this.setupHook()
 
-    for (let i = 1; i <= this.numWorkers; i++) {
+    for (let i = 1; i <= this.numberOfWorkers; i++) {
       this.internalNewWorker()
     }
 
@@ -130,7 +130,18 @@ export abstract class AbstractPool<
   }
 
   /**
-   * Setup hook that can be overridden by a Poolifer pool implementation
+   * Number of workers that this pool should manage.
+   *
+   * @returns Number of workers that this pool manages.
+   * @deprecated Only here for backward compatibility.
+   */
+  // eslint-disable-next-line spellcheck/spell-checker
+  public get numWorkers (): number {
+    return this.numberOfWorkers
+  }
+
+  /**
+   * Setup hook that can be overridden by a Poolifier pool implementation
    * to run code before workers are created in the abstract constructor.
    */
   protected setupHook (): void {