refactor: limit pool internals public exposure
authorJérôme Benoit <jerome.benoit@sap.com>
Sun, 4 Jun 2023 11:18:43 +0000 (13:18 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Sun, 4 Jun 2023 11:18:43 +0000 (13:18 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
CHANGELOG.md
src/pools/abstract-pool.ts
src/pools/cluster/dynamic.ts
src/pools/thread/dynamic.ts

index 134b1745b54ec1d8527d0377d78e1b1cfa036a0e..25e560338216145c56561276c9ab98991ff446d4 100644 (file)
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 ### Changed
 
 - Refine pool information content.
+- Limit pool internals public exposure.
 
 ## [2.5.2] - 2023-06-02
 
index 538d66c797fabc98e93a130953fdde2ee9edfdc8..5d7e8cd82286749884ebdb726684e444bbd1c395 100644 (file)
@@ -78,9 +78,9 @@ export abstract class AbstractPool<
    * @param opts - Options for the pool.
    */
   public constructor (
-    public readonly numberOfWorkers: number,
-    public readonly filePath: string,
-    public readonly opts: PoolOptions<Worker>
+    protected readonly numberOfWorkers: number,
+    protected readonly filePath: string,
+    protected readonly opts: PoolOptions<Worker>
   ) {
     if (!this.isMain()) {
       throw new Error('Cannot start a pool from a worker!')
index cae9970006fdc1c62bb030d77802cac98eb9ff51..eb86ba853170f5edc83a7bd181e5fb9c45b172d5 100644 (file)
@@ -26,7 +26,7 @@ export class DynamicClusterPool<
    */
   public constructor (
     min: number,
-    public readonly max: number,
+    protected readonly max: number,
     filePath: string,
     opts: ClusterPoolOptions = {}
   ) {
index 04931b7423423002c6130cd4b07ee0631684ae7b..8cdb0d5c6328d318798d4465f1a5a07aeb338c2a 100644 (file)
@@ -26,7 +26,7 @@ export class DynamicThreadPool<
    */
   public constructor (
     min: number,
-    public readonly max: number,
+    protected readonly max: number,
     filePath: string,
     opts: PoolOptions<ThreadWorkerWithMessageChannel> = {}
   ) {