From 3749facbef3139d185918f89b1e29c69fc02015f Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Tue, 27 Jun 2023 17:54:17 +0200 Subject: [PATCH] fix: register message handler on worker only MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- CHANGELOG.md | 4 ++++ src/worker/abstract-worker.ts | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dba4ff69..49f72b43 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- Ensure message handler is only registered in worker. + ## [2.6.5] - 2023-06-27 ### Known issues diff --git a/src/worker/abstract-worker.ts b/src/worker/abstract-worker.ts index f42f2c47..25be4820 100644 --- a/src/worker/abstract-worker.ts +++ b/src/worker/abstract-worker.ts @@ -90,8 +90,8 @@ export abstract class AbstractWorker< (this.opts.maxInactiveTime ?? DEFAULT_MAX_INACTIVE_TIME) / 2 ) this.checkAlive.bind(this)() + this.mainWorker?.on('message', this.messageListener.bind(this)) } - this.mainWorker?.on('message', this.messageListener.bind(this)) } private checkWorkerOptions (opts: WorkerOptions): void { -- 2.34.1