From: Jérôme Benoit Date: Sat, 1 Jul 2023 22:03:02 +0000 (+0200) Subject: docs: improve code documentation X-Git-Tag: v2.6.7~17 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=64383951fbf11fdf6a804fc6d081635fb925e403;p=poolifier.git docs: improve code documentation Signed-off-by: Jérôme Benoit --- diff --git a/src/pools/pool.ts b/src/pools/pool.ts index 7c6f6769..87f4a8fa 100644 --- a/src/pools/pool.ts +++ b/src/pools/pool.ts @@ -72,9 +72,13 @@ export interface PoolInfo { worker: WorkerType minSize: number maxSize: number + /** Pool utilization ratio. */ utilization: number + /** Pool total worker nodes */ workerNodes: number + /** Pool idle worker nodes */ idleWorkerNodes: number + /** Pool busy worker nodes */ busyWorkerNodes: number executedTasks: number executingTasks: number @@ -189,7 +193,7 @@ export interface IPool< */ execute: (data?: Data, name?: string) => Promise /** - * Terminate every current worker in this pool. + * Terminates every current worker in this pool. */ destroy: () => Promise /** diff --git a/src/pools/selection-strategies/selection-strategies-types.ts b/src/pools/selection-strategies/selection-strategies-types.ts index ac2ee6c3..dc174814 100644 --- a/src/pools/selection-strategies/selection-strategies-types.ts +++ b/src/pools/selection-strategies/selection-strategies-types.ts @@ -107,15 +107,15 @@ export interface WorkerChoiceStrategyOptions { */ export interface MeasurementStatisticsRequirements { /** - * Require measurement aggregate. + * Requires measurement aggregate. */ aggregate: boolean /** - * Require measurement average. + * Requires measurement average. */ average: boolean /** - * Require measurement median. + * Requires measurement median. */ median: boolean } diff --git a/src/pools/worker.ts b/src/pools/worker.ts index 86f5121d..dc283e0e 100644 --- a/src/pools/worker.ts +++ b/src/pools/worker.ts @@ -147,7 +147,7 @@ export interface WorkerUsage { */ export interface IWorker { /** - * Register an event listener. + * Registers an event listener. * * @param event - The event. * @param handler - The event handler. @@ -157,7 +157,7 @@ export interface IWorker { ((event: 'online', handler: OnlineHandler) => void) & ((event: 'exit', handler: ExitHandler) => void) /** - * Register a listener to the exit event that will only be performed once. + * Registers a listener to the exit event that will only be performed once. * * @param event - `'exit'`. * @param handler - The exit handler. diff --git a/src/queue.ts b/src/queue.ts index e7c9dd11..ead4b637 100644 --- a/src/queue.ts +++ b/src/queue.ts @@ -51,7 +51,7 @@ export class Queue { } /** - * Peek at the first item. + * Peeks at the first item. * * @returns The first item or `undefined` if the queue is empty. */ @@ -63,7 +63,7 @@ export class Queue { } /** - * Clear the queue. + * Clears the queue. */ public clear (): void { this.items = [] diff --git a/src/utils.ts b/src/utils.ts index 6d11f88c..7ac4ab25 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -73,6 +73,7 @@ export const median = (dataSet: number[]): number => { /** * Rounds the given number to the given scale. + * The rounding is done using the "round half away from zero" method. * * @param num - The number to round. * @param scale - The scale to round to.