Skip to content

Commit 00e5ebc

Browse files
committed
fix: add workerNodeKeys validation and remove misleading JSDoc
1 parent 1312b5b commit 00e5ebc

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

src/pools/abstract-pool.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2212,6 +2212,14 @@ export abstract class AbstractPool<
22122212
if (ready == null || !ready) {
22132213
throw new Error(`Worker ${workerId?.toString()} failed to initialize`)
22142214
}
2215+
const maxPoolSize =
2216+
this.maximumNumberOfWorkers ?? this.minimumNumberOfWorkers
2217+
for (const taskFunctionProperties of taskFunctionsProperties ?? []) {
2218+
checkValidWorkerNodeKeys(
2219+
taskFunctionProperties.workerNodeKeys,
2220+
maxPoolSize,
2221+
)
2222+
}
22152223
const workerNodeKey = this.getWorkerNodeKeyByWorkerId(workerId)
22162224
const workerNode = this.workerNodes[workerNodeKey]
22172225
workerNode.info.ready = ready

src/worker/task-functions.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@ export interface TaskFunctionObject<Data = unknown, Response = unknown> {
6262
* Restricts task execution to specified worker nodes by their indices.
6363
* Must contain valid indices within [0, pool max size - 1].
6464
* If undefined, task can execute on any worker node.
65-
* @remarks `null` is not accepted here. Use `null` only via
66-
* {@link TaskFunctionProperties.workerNodeKeys} to clear affinity at runtime.
6765
*/
6866
workerNodeKeys?: number[]
6967
}

0 commit comments

Comments
 (0)