From 5baee0d7ba81f62bb4547e02e278babd787ef746 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Tue, 6 Jun 2023 20:35:21 +0200 Subject: [PATCH] fix: dynamic pool options change 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 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/pools/abstract-pool.ts b/src/pools/abstract-pool.ts index ce645cc8..b86a3b13 100644 --- a/src/pools/abstract-pool.ts +++ b/src/pools/abstract-pool.ts @@ -342,7 +342,7 @@ export abstract class AbstractPool< this.checkValidTasksQueueOptions(tasksQueueOptions) this.opts.tasksQueueOptions = this.buildTasksQueueOptions(tasksQueueOptions) - } else { + } else if (this.opts.tasksQueueOptions != null) { delete this.opts.tasksQueueOptions } } @@ -625,11 +625,11 @@ export abstract class AbstractPool< this.emitter.emit(PoolEvents.error, error) } }) - if (this.opts.restartWorkerOnError === true) { - worker.on('error', () => { + worker.on('error', () => { + if (this.opts.restartWorkerOnError === true) { this.createAndSetupWorker() - }) - } + } + }) worker.on('online', this.opts.onlineHandler ?? EMPTY_FUNCTION) worker.on('exit', this.opts.exitHandler ?? EMPTY_FUNCTION) worker.once('exit', () => { -- 2.34.1