From 7c8381eb33aaff689afe1944d8643508003cf0b1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sat, 8 Jul 2023 01:05:03 +0200 Subject: [PATCH] refactor: rename worker `started` flag to `ready` 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 | 14 +++++++------- src/pools/worker-node.ts | 2 +- src/pools/worker.ts | 4 ++-- src/utility-types.ts | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/pools/abstract-pool.ts b/src/pools/abstract-pool.ts index 9da56621..53bce7d2 100644 --- a/src/pools/abstract-pool.ts +++ b/src/pools/abstract-pool.ts @@ -968,9 +968,9 @@ export abstract class AbstractPool< */ protected workerListener (): (message: MessageValue) => void { return message => { - if (message.workerId != null && message.started != null) { - // Worker started message received - this.handleWorkerStartedMessage(message) + if (message.workerId != null && message.ready != null) { + // Worker ready message received + this.handleWorkerReadyMessage(message) } else if (message.id != null) { // Task execution response received this.handleTaskExecutionResponse(message) @@ -978,14 +978,14 @@ export abstract class AbstractPool< } } - private handleWorkerStartedMessage (message: MessageValue): void { + private handleWorkerReadyMessage (message: MessageValue): void { const worker = this.getWorkerById(message.workerId as number) if (worker != null) { - this.getWorkerInfo(this.getWorkerNodeKey(worker)).started = - message.started as boolean + this.getWorkerInfo(this.getWorkerNodeKey(worker)).ready = + message.ready as boolean } else { throw new Error( - `Worker started message received from unknown worker '${ + `Worker ready message received from unknown worker '${ message.workerId as number }'` ) diff --git a/src/pools/worker-node.ts b/src/pools/worker-node.ts index c2acd65b..0a6b8de7 100644 --- a/src/pools/worker-node.ts +++ b/src/pools/worker-node.ts @@ -75,7 +75,7 @@ implements IWorkerNode { id: this.getWorkerId(worker, workerType), type: workerType, dynamic: false, - started: true + ready: true } } diff --git a/src/pools/worker.ts b/src/pools/worker.ts index 81b49d3b..5b427a56 100644 --- a/src/pools/worker.ts +++ b/src/pools/worker.ts @@ -157,9 +157,9 @@ export interface WorkerInfo { */ dynamic: boolean /** - * Started flag. + * Ready flag. */ - started: boolean + ready: boolean } /** diff --git a/src/utility-types.ts b/src/utility-types.ts index 20352350..f1b773eb 100644 --- a/src/utility-types.ts +++ b/src/utility-types.ts @@ -82,9 +82,9 @@ export interface MessageValue */ readonly statistics?: WorkerStatistics /** - * Whether the worker has started or not. + * Whether the worker is ready or not. */ - readonly started?: boolean + readonly ready?: boolean /** * Whether the worker starts or stops its aliveness check. */ -- 2.34.1