From: Jérôme Benoit Date: Fri, 7 Jul 2023 22:53:53 +0000 (+0200) Subject: docs: add comments to worker node class X-Git-Tag: v2.6.10~9 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=60664f486ce7ff5a437b52c545cf219eca5aebd2;p=poolifier.git docs: add comments to worker node class Signed-off-by: Jérôme Benoit --- diff --git a/src/pools/worker-node.ts b/src/pools/worker-node.ts index eb2085bc..c2acd65b 100644 --- a/src/pools/worker-node.ts +++ b/src/pools/worker-node.ts @@ -10,6 +10,12 @@ import { type WorkerUsage } from './worker' +/** + * Worker node. + * + * @typeParam Worker - Type of worker. + * @typeParam Data - Type of data sent to the worker. This can only be structured-cloneable data. + */ export class WorkerNode implements IWorkerNode { public readonly worker: Worker @@ -17,6 +23,13 @@ implements IWorkerNode { public usage: WorkerUsage private readonly tasksQueue: Queue> + /** + * Constructs a new worker node. + * + * @param worker - The worker. + * @param workerType - The worker type. + * @internal + */ constructor (worker: Worker, workerType: WorkerType) { this.worker = worker this.info = this.initWorkerInfo(worker, workerType) @@ -106,6 +119,7 @@ implements IWorkerNode { * Gets the worker id. * * @param worker - The worker. + * @param workerType - The worker type. * @returns The worker id. */ private getWorkerId (