From: Jérôme Benoit Date: Tue, 6 Jun 2023 18:35:21 +0000 (+0200) Subject: fix: dynamic pool options change X-Git-Tag: v2.5.4~16^2 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=5baee0d7ba81f62bb4547e02e278babd787ef746;p=poolifier.git fix: dynamic pool options change Signed-off-by: Jérôme Benoit --- 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', () => {