From: Jérôme Benoit Date: Thu, 6 Jul 2023 22:25:35 +0000 (+0200) Subject: refactor: cleanup worker message handling code X-Git-Tag: v2.6.9~1^2 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=d3d981d0642550d0ece8d9368dea362668f83904;p=poolifier.git refactor: cleanup worker message handling code Signed-off-by: Jérôme Benoit --- 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)