From 8e5a7cf9360dd0cfd5af8b21c245c10b6983cca4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Wed, 18 Oct 2023 17:32:55 +0200 Subject: [PATCH] perf: remove unneeded nullish check 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 | 5 +---- src/worker/abstract-worker.ts | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/pools/abstract-pool.ts b/src/pools/abstract-pool.ts index 645a31e1..ef5ebead 100644 --- a/src/pools/abstract-pool.ts +++ b/src/pools/abstract-pool.ts @@ -495,10 +495,7 @@ export abstract class AbstractPool< private checkMessageWorkerId (message: MessageValue): void { if (message.workerId == null) { throw new Error('Worker message received without worker id') - } else if ( - message.workerId != null && - this.getWorkerNodeKeyByWorkerId(message.workerId) === -1 - ) { + } else if (this.getWorkerNodeKeyByWorkerId(message.workerId) === -1) { throw new Error( `Worker message received from unknown worker '${message.workerId}'` ) diff --git a/src/worker/abstract-worker.ts b/src/worker/abstract-worker.ts index e10521fc..43135467 100644 --- a/src/worker/abstract-worker.ts +++ b/src/worker/abstract-worker.ts @@ -405,7 +405,7 @@ export abstract class AbstractWorker< private checkMessageWorkerId (message: MessageValue): void { if (message.workerId == null) { throw new Error('Message worker id is not set') - } else if (message.workerId != null && message.workerId !== this.id) { + } else if (message.workerId !== this.id) { throw new Error( `Message worker id ${message.workerId} does not match the worker id ${this.id}` ) -- 2.34.1