From d3d981d0642550d0ece8d9368dea362668f83904 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Fri, 7 Jul 2023 00:25:35 +0200 Subject: [PATCH] refactor: cleanup worker message handling code MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/worker/abstract-worker.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/worker/abstract-worker.ts b/src/worker/abstract-worker.ts index b8b442ec..ba74409e 100644 --- a/src/worker/abstract-worker.ts +++ b/src/worker/abstract-worker.ts @@ -145,12 +145,12 @@ export abstract class AbstractWorker< * @param message - Message received. */ protected messageListener (message: MessageValue): void { - if (message.dynamic === true) { - // Worker dynamic message received - this.startCheckAlive() - } else if (message.statistics != null) { + if (message.statistics != null) { // Statistics message received this.statistics = message.statistics + } else if (message.dynamic === true) { + // Worker dynamic message received + this.startCheckAlive() } else if (message.id != null && message.data != null) { // Task message received const fn = this.getTaskFunction(message.name) -- 2.34.1