From e8a4c3ea4d5123ff7c158d139ca142144ccc1117 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sun, 2 Jul 2023 11:59:28 +0200 Subject: [PATCH] refactor: cleanup debug code MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/pools/abstract-pool.ts | 10 +--------- src/worker/cluster-worker.ts | 4 ---- src/worker/thread-worker.ts | 4 ---- tests/pools/abstract/abstract-pool.test.js | 6 ------ 4 files changed, 1 insertion(+), 23 deletions(-) diff --git a/src/pools/abstract-pool.ts b/src/pools/abstract-pool.ts index f931a466..a963f6bd 100644 --- a/src/pools/abstract-pool.ts +++ b/src/pools/abstract-pool.ts @@ -245,14 +245,6 @@ export abstract class AbstractPool< } } - private get starting (): boolean { - return this.workerNodes.some(workerNode => !workerNode.info.started) - } - - private get started (): boolean { - return this.workerNodes.some(workerNode => workerNode.info.started) - } - /** @inheritDoc */ public get info (): PoolInfo { return { @@ -770,7 +762,7 @@ export abstract class AbstractPool< if (this.emitter != null) { this.emitter.emit(PoolEvents.error, error) } - if (this.opts.restartWorkerOnError === true && !this.starting) { + if (this.opts.restartWorkerOnError === true) { this.createAndSetupWorker() } }) diff --git a/src/worker/cluster-worker.ts b/src/worker/cluster-worker.ts index 16dddd29..180a5273 100644 --- a/src/worker/cluster-worker.ts +++ b/src/worker/cluster-worker.ts @@ -41,9 +41,6 @@ export class ClusterWorker< cluster.worker as Worker, opts ) - if (!this.isMain) { - this.sendToMainWorker({ workerId: this.id, started: true }) - } } /** @inheritDoc */ @@ -53,7 +50,6 @@ export class ClusterWorker< /** @inheritDoc */ protected sendToMainWorker (message: MessageValue): void { - console.log('sending message to main worker(cluster)', message) this.getMainWorker().send(message) } diff --git a/src/worker/thread-worker.ts b/src/worker/thread-worker.ts index 7a766a95..2b3df583 100644 --- a/src/worker/thread-worker.ts +++ b/src/worker/thread-worker.ts @@ -46,9 +46,6 @@ export class ThreadWorker< parentPort as MessagePort, opts ) - if (!this.isMain) { - this.sendToMainWorker({ workerId: this.id, started: true }) - } } protected get id (): number { @@ -57,7 +54,6 @@ export class ThreadWorker< /** @inheritDoc */ protected sendToMainWorker (message: MessageValue): void { - console.log('sending message to main worker(thread)', message) this.getMainWorker().postMessage(message) } } diff --git a/tests/pools/abstract/abstract-pool.test.js b/tests/pools/abstract/abstract-pool.test.js index 7c42d34a..023b56b4 100644 --- a/tests/pools/abstract/abstract-pool.test.js +++ b/tests/pools/abstract/abstract-pool.test.js @@ -407,9 +407,6 @@ describe('Abstract pool test suite', () => { maxQueuedTasks: 0, failedTasks: 0 }) - for (const workerNode of pool.workerNodes) { - console.log('thread:workerNode.info', workerNode.info) - } await pool.destroy() pool = new DynamicClusterPool( numberOfWorkers, @@ -431,9 +428,6 @@ describe('Abstract pool test suite', () => { maxQueuedTasks: 0, failedTasks: 0 }) - for (const workerNode of pool.workerNodes) { - console.log('cluster:workerNode.info', workerNode.info) - } await pool.destroy() }) -- 2.34.1