From: Jérôme Benoit Date: Tue, 21 May 2024 21:19:38 +0000 (+0200) Subject: docs: refine circular buffer code comments X-Git-Tag: v4.0.12~11 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=db89e3bcb546d7302179437c4fa88d6fd03bccf0;p=poolifier.git docs: refine circular buffer code comments Signed-off-by: Jérôme Benoit --- diff --git a/src/circular-buffer.ts b/src/circular-buffer.ts index baa92192..9f9678d1 100644 --- a/src/circular-buffer.ts +++ b/src/circular-buffer.ts @@ -1,10 +1,13 @@ /** - * Default buffer size + * Default buffer size. */ export const defaultBufferSize = 2048 /** * Circular buffer + * + * @typeParam T - Type of buffer data. + * @internal */ export class CircularBuffer { private readonly readIdx: number @@ -13,8 +16,8 @@ export class CircularBuffer { private readonly maxArrayIdx: number /** - * @param size - Buffer size - * @returns CircularBuffer + * @param size - Buffer size. @defaultValue defaultBufferSize + * @returns CircularBuffer. */ constructor (size: number = defaultBufferSize) { this.checkSize(size) @@ -25,9 +28,9 @@ export class CircularBuffer { } /** - * Puts data into buffer + * Puts data into buffer. * - * @param data - Data to put into buffer + * @param data - Data to put into buffer. */ public put (data: T): void { this.items[this.writeIdx] = data @@ -35,9 +38,9 @@ export class CircularBuffer { } /** - * Returns buffer as array + * Returns buffer as array. * - * @returns T[] + * @returns Array of buffer data. */ public toArray (): T[] { return this.items.filter(item => item != null) as T[] diff --git a/src/pools/abstract-pool.ts b/src/pools/abstract-pool.ts index a7d3e944..ebdb0dd8 100644 --- a/src/pools/abstract-pool.ts +++ b/src/pools/abstract-pool.ts @@ -1473,7 +1473,7 @@ export abstract class AbstractPool< * Chooses a worker node for the next task. * * @param name - The task function name. - * @returns The chosen worker node key + * @returns The chosen worker node key. */ private chooseWorkerNode (name?: string): number { if (this.shallCreateDynamicWorker()) {