From b4213b7fc45201c5a38f2615289c569b679a15b7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sun, 4 Jun 2023 13:18:43 +0200 Subject: [PATCH] refactor: limit pool internals public exposure MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- CHANGELOG.md | 1 + src/pools/abstract-pool.ts | 6 +++--- src/pools/cluster/dynamic.ts | 2 +- src/pools/thread/dynamic.ts | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 134b1745..25e56033 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/src/pools/abstract-pool.ts b/src/pools/abstract-pool.ts index 538d66c7..5d7e8cd8 100644 --- a/src/pools/abstract-pool.ts +++ b/src/pools/abstract-pool.ts @@ -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 + protected readonly numberOfWorkers: number, + protected readonly filePath: string, + protected readonly opts: PoolOptions ) { if (!this.isMain()) { throw new Error('Cannot start a pool from a worker!') diff --git a/src/pools/cluster/dynamic.ts b/src/pools/cluster/dynamic.ts index cae99700..eb86ba85 100644 --- a/src/pools/cluster/dynamic.ts +++ b/src/pools/cluster/dynamic.ts @@ -26,7 +26,7 @@ export class DynamicClusterPool< */ public constructor ( min: number, - public readonly max: number, + protected readonly max: number, filePath: string, opts: ClusterPoolOptions = {} ) { diff --git a/src/pools/thread/dynamic.ts b/src/pools/thread/dynamic.ts index 04931b74..8cdb0d5c 100644 --- a/src/pools/thread/dynamic.ts +++ b/src/pools/thread/dynamic.ts @@ -26,7 +26,7 @@ export class DynamicThreadPool< */ public constructor ( min: number, - public readonly max: number, + protected readonly max: number, filePath: string, opts: PoolOptions = {} ) { -- 2.34.1