Mark some attributes readonly
authorJérôme Benoit <jerome.benoit@sap.com>
Sun, 3 Oct 2021 02:45:27 +0000 (04:45 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Sun, 3 Oct 2021 02:45:27 +0000 (04:45 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
src/worker/WorkerAbstract.ts
src/worker/WorkerDynamicPool.ts
src/worker/WorkerSet.ts
src/worker/WorkerStaticPool.ts

index a18a085e5e0a37a58b3b31127976005f3fe4f9be..fa28597c55784d585fcec7231f0aea69e298bee1 100644 (file)
@@ -4,8 +4,8 @@ import { WorkerData } from '../types/Worker';
 export default abstract class WorkerAbstract {
   protected readonly workerScript: string;
   protected readonly workerStartDelay: number;
-  public abstract size: number;
-  public abstract maxElementsPerWorker: number | null;
+  public abstract readonly size: number;
+  public abstract readonly maxElementsPerWorker: number | null;
 
   /**
    * `WorkerAbstract` constructor.
index f081b3c3018ae0f144001b3138e355fbff52e159..e2dd3b1e9bdd76cededb0762401561ebca952e75 100644 (file)
@@ -7,7 +7,7 @@ import { WorkerData } from '../types/Worker';
 import { WorkerUtils } from './WorkerUtils';
 
 export default class WorkerDynamicPool<T> extends WorkerAbstract {
-  private pool: DynamicThreadPool<WorkerData>;
+  private readonly pool: DynamicThreadPool<WorkerData>;
 
   /**
    * Create a new `WorkerDynamicPool`.
index f25fd03c4872849fc0863fb9806864e44dc45da1..d179608ddb829877802538236f0153424a86a1d7 100644 (file)
@@ -10,7 +10,7 @@ import { WorkerUtils } from './WorkerUtils';
 export default class WorkerSet<T> extends WorkerAbstract {
   public readonly maxElementsPerWorker: number;
   private readonly messageHandler: (message: unknown) => void | Promise<void>;
-  private workerSet: Set<WorkerSetElement>;
+  private readonly workerSet: Set<WorkerSetElement>;
 
   /**
    * Create a new `WorkerSet`.
index cbc62fb63bfe45be928c5810c67c22bb862297de..d5d6390c7b2e43ad5175fa46b21c41122879e7ed 100644 (file)
@@ -7,7 +7,7 @@ import { WorkerData } from '../types/Worker';
 import { WorkerUtils } from './WorkerUtils';
 
 export default class WorkerStaticPool<T> extends WorkerAbstract {
-  private pool: FixedThreadPool<WorkerData>;
+  private readonly pool: FixedThreadPool<WorkerData>;
 
   /**
    * Create a new `WorkerStaticPool`.