import type { CircularArray } from '../circular-array'
import type { Task } from '../utility-types'
+/**
+ * Callback invoked when the worker has started successfully.
+ */
+export type OnlineHandler<Worker extends IWorker> = (this: Worker) => void
+
/**
* Callback invoked if the worker has received a message.
*/
error: Error
) => void
-/**
- * Callback invoked when the worker has started successfully.
- */
-export type OnlineHandler<Worker extends IWorker> = (this: Worker) => void
-
/**
* Callback invoked when the worker exits successfully.
*/
*/
readonly clearTasksQueue: () => void
/**
- * Resets usage statistics .
+ * Whether the worker node has back pressure (i.e. its tasks queue is full).
+ *
+ * @returns `true` if the worker node has back pressure, `false` otherwise.
+ */
+ readonly hasBackPressure: () => boolean
+ /**
+ * Resets usage statistics.
*/
readonly resetUsage: () => void
/**
*/
readonly closeChannel: () => void
/**
- * Gets task worker usage statistics.
+ * Gets task function worker usage statistics.
+ *
+ * @param name - The task function name.
+ * @returns The task function worker usage statistics if the task function worker usage statistics are initialized, `undefined` otherwise.
*/
- readonly getTaskWorkerUsage: (name: string) => WorkerUsage | undefined
+ readonly getTaskFunctionWorkerUsage: (name: string) => WorkerUsage | undefined
}