From: Jérôme Benoit Date: Fri, 7 Jul 2023 23:05:03 +0000 (+0200) Subject: refactor: rename worker `started` flag to `ready` X-Git-Tag: v2.6.10~8 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=7c8381eb33aaff689afe1944d8643508003cf0b1;p=poolifier.git refactor: rename worker `started` flag to `ready` Signed-off-by: Jérôme Benoit --- 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. */