poolifier
Advanced tools
Comparing version 2.4.7 to 2.4.8
@@ -12,3 +12,3 @@ import type { MessageValue, PromiseResponseWrapper } from '../utility-types'; | ||
* @typeParam Data - Type of data sent to the worker. This can only be serializable data. | ||
* @typeParam Response - Type of response of execution. This can only be serializable data. | ||
* @typeParam Response - Type of execution response. This can only be serializable data. | ||
*/ | ||
@@ -178,2 +178,3 @@ export declare abstract class AbstractPool<Worker extends IWorker, Data = unknown, Response = unknown> implements IPool<Worker, Data, Response> { | ||
* @param worker - The worker. | ||
* @throws {@link Error} if the worker is not found in the pool worker nodes. | ||
* @returns The worker tasks usage. | ||
@@ -180,0 +181,0 @@ */ |
@@ -11,3 +11,3 @@ import { PoolType } from '../pool'; | ||
* @typeParam Data - Type of data sent to the worker. This can only be serializable data. | ||
* @typeParam Response - Type of response of execution. This can only be serializable data. | ||
* @typeParam Response - Type of execution response. This can only be serializable data. | ||
* @author [Christopher Quadflieg](https://github.com/Shinigami92) | ||
@@ -14,0 +14,0 @@ * @since 2.0.0 |
@@ -32,3 +32,3 @@ /// <reference types="node" /> | ||
* @typeParam Data - Type of data sent to the worker. This can only be serializable data. | ||
* @typeParam Response - Type of response of execution. This can only be serializable data. | ||
* @typeParam Response - Type of execution response. This can only be serializable data. | ||
* @author [Christopher Quadflieg](https://github.com/Shinigami92) | ||
@@ -35,0 +35,0 @@ * @since 2.0.0 |
@@ -9,2 +9,3 @@ /// <reference types="node" /> | ||
* @enum | ||
* @internal | ||
*/ | ||
@@ -51,3 +52,3 @@ export declare enum PoolType { | ||
* | ||
* @typeParam Worker - The worker type. | ||
* @typeParam Worker - Type of worker. | ||
*/ | ||
@@ -104,3 +105,3 @@ export interface PoolOptions<Worker extends IWorker> { | ||
* @typeParam Data - Type of data sent to the worker. This can only be serializable data. | ||
* @typeParam Response - Type of response of execution. This can only be serializable data. | ||
* @typeParam Response - Type of execution response. This can only be serializable data. | ||
*/ | ||
@@ -107,0 +108,0 @@ export interface IPool<Worker extends IWorker, Data = unknown, Response = unknown> { |
@@ -9,3 +9,3 @@ import { type IPool } from '../pool'; | ||
* @typeParam Data - Type of data sent to the worker. This can only be serializable data. | ||
* @typeParam Response - Type of response of execution. This can only be serializable data. | ||
* @typeParam Response - Type of execution response. This can only be serializable data. | ||
*/ | ||
@@ -12,0 +12,0 @@ export declare abstract class AbstractWorkerChoiceStrategy<Worker extends IWorker, Data = unknown, Response = unknown> implements IWorkerChoiceStrategy { |
@@ -10,3 +10,3 @@ import type { IWorker } from '../worker'; | ||
* @typeParam Data - Type of data sent to the worker. This can only be serializable data. | ||
* @typeParam Response - Type of response of execution. This can only be serializable data. | ||
* @typeParam Response - Type of execution response. This can only be serializable data. | ||
*/ | ||
@@ -13,0 +13,0 @@ export declare class FairShareWorkerChoiceStrategy<Worker extends IWorker, Data = unknown, Response = unknown> extends AbstractWorkerChoiceStrategy<Worker, Data, Response> implements IWorkerChoiceStrategy { |
@@ -9,3 +9,3 @@ import type { IWorker } from '../worker'; | ||
* @typeParam Data - Type of data sent to the worker. This can only be serializable data. | ||
* @typeParam Response - Type of response of execution. This can only be serializable data. | ||
* @typeParam Response - Type of execution response. This can only be serializable data. | ||
*/ | ||
@@ -12,0 +12,0 @@ export declare class LessBusyWorkerChoiceStrategy<Worker extends IWorker, Data = unknown, Response = unknown> extends AbstractWorkerChoiceStrategy<Worker, Data, Response> implements IWorkerChoiceStrategy { |
@@ -9,3 +9,3 @@ import type { IWorker } from '../worker'; | ||
* @typeParam Data - Type of data sent to the worker. This can only be serializable data. | ||
* @typeParam Response - Type of response of execution. This can only be serializable data. | ||
* @typeParam Response - Type of execution response. This can only be serializable data. | ||
*/ | ||
@@ -12,0 +12,0 @@ export declare class LessUsedWorkerChoiceStrategy<Worker extends IWorker, Data = unknown, Response = unknown> extends AbstractWorkerChoiceStrategy<Worker, Data, Response> implements IWorkerChoiceStrategy { |
@@ -9,3 +9,3 @@ import type { IWorker } from '../worker'; | ||
* @typeParam Data - Type of data sent to the worker. This can only be serializable data. | ||
* @typeParam Response - Type of response of execution. This can only be serializable data. | ||
* @typeParam Response - Type of execution response. This can only be serializable data. | ||
*/ | ||
@@ -12,0 +12,0 @@ export declare class RoundRobinWorkerChoiceStrategy<Worker extends IWorker, Data = unknown, Response = unknown> extends AbstractWorkerChoiceStrategy<Worker, Data, Response> implements IWorkerChoiceStrategy { |
@@ -41,2 +41,4 @@ /** | ||
* Pool worker tasks usage statistics requirements. | ||
* | ||
* @internal | ||
*/ | ||
@@ -43,0 +45,0 @@ export interface RequiredStatistics { |
@@ -11,3 +11,3 @@ import type { IWorker } from '../worker'; | ||
* @typeParam Data - Type of data sent to the worker. This can only be serializable data. | ||
* @typeParam Response - Type of response of execution. This can only be serializable data. | ||
* @typeParam Response - Type of execution response. This can only be serializable data. | ||
*/ | ||
@@ -14,0 +14,0 @@ export declare class WeightedRoundRobinWorkerChoiceStrategy<Worker extends IWorker, Data = unknown, Response = unknown> extends AbstractWorkerChoiceStrategy<Worker, Data, Response> implements IWorkerChoiceStrategy { |
@@ -9,3 +9,3 @@ import type { IPool } from '../pool'; | ||
* @typeParam Data - Type of data sent to the worker. This can only be serializable data. | ||
* @typeParam Response - Type of response of execution. This can only be serializable data. | ||
* @typeParam Response - Type of execution response. This can only be serializable data. | ||
*/ | ||
@@ -12,0 +12,0 @@ export declare class WorkerChoiceStrategyContext<Worker extends IWorker, Data = unknown, Response = unknown> { |
@@ -12,3 +12,3 @@ import type { PoolOptions } from '../pool'; | ||
* @typeParam Data - Type of data sent to the worker. This can only be serializable data. | ||
* @typeParam Response - Type of response of execution. This can only be serializable data. | ||
* @typeParam Response - Type of execution response. This can only be serializable data. | ||
* @author [Alessandro Pio Ardizio](https://github.com/pioardi) | ||
@@ -15,0 +15,0 @@ * @since 0.0.1 |
@@ -19,3 +19,3 @@ /// <reference types="node" /> | ||
* @typeParam Data - Type of data sent to the worker. This can only be serializable data. | ||
* @typeParam Response - Type of response of execution. This can only be serializable data. | ||
* @typeParam Response - Type of execution response. This can only be serializable data. | ||
* @author [Alessandro Pio Ardizio](https://github.com/pioardi) | ||
@@ -22,0 +22,0 @@ * @since 0.0.1 |
@@ -19,3 +19,3 @@ import type { CircularArray } from '../circular-array'; | ||
/** | ||
* Worker task interface. | ||
* Message object that is passed as a task between main worker and worker. | ||
* | ||
@@ -27,20 +27,43 @@ * @typeParam Data - Type of data sent to the worker. This can only be serializable data. | ||
/** | ||
* Worker task data. | ||
* Input data that will be passed to the worker. | ||
*/ | ||
data: Data; | ||
readonly data?: Data; | ||
/** | ||
* Task UUID. | ||
* UUID of the message. | ||
*/ | ||
id: string; | ||
readonly id?: string; | ||
} | ||
/** | ||
* Worker tasks usage statistics. | ||
* | ||
* @internal | ||
*/ | ||
export interface TasksUsage { | ||
/** | ||
* Number of tasks executed. | ||
*/ | ||
run: number; | ||
/** | ||
* Number of tasks running. | ||
*/ | ||
running: number; | ||
/** | ||
* Tasks runtime. | ||
*/ | ||
runTime: number; | ||
/** | ||
* Tasks runtime history. | ||
*/ | ||
runTimeHistory: CircularArray<number>; | ||
/** | ||
* Average tasks runtime. | ||
*/ | ||
avgRunTime: number; | ||
/** | ||
* Median tasks runtime. | ||
*/ | ||
medRunTime: number; | ||
/** | ||
* Number of tasks errored. | ||
*/ | ||
error: number; | ||
@@ -78,3 +101,3 @@ } | ||
*/ | ||
worker: Worker; | ||
readonly worker: Worker; | ||
/** | ||
@@ -87,3 +110,3 @@ * Worker node tasks usage statistics. | ||
*/ | ||
tasksQueue: Array<Task<Data>>; | ||
readonly tasksQueue: Array<Task<Data>>; | ||
} |
@@ -6,3 +6,3 @@ /// <reference types="node" /> | ||
import type { KillBehavior } from './worker/worker-options'; | ||
import type { IWorker } from './pools/worker'; | ||
import type { IWorker, Task } from './pools/worker'; | ||
/** | ||
@@ -15,17 +15,10 @@ * Make all properties in T non-readonly. | ||
/** | ||
* Message object that is passed between worker and main worker. | ||
* Message object that is passed between main worker and worker. | ||
* | ||
* @typeParam Data - Type of data sent to the worker. This can only be serializable data. | ||
* @typeParam MainWorker - Type of main worker. | ||
* @internal | ||
*/ | ||
export interface MessageValue<Data = unknown, MainWorker extends ClusterWorker | MessagePort | unknown = unknown> { | ||
export interface MessageValue<Data = unknown, MainWorker extends ClusterWorker | MessagePort | unknown = unknown> extends Task<Data> { | ||
/** | ||
* Input data that will be passed to the worker. | ||
*/ | ||
readonly data?: Data; | ||
/** | ||
* Id of the message. | ||
*/ | ||
readonly id?: string; | ||
/** | ||
* Kill code. | ||
@@ -32,0 +25,0 @@ */ |
@@ -21,3 +21,3 @@ /** | ||
* | ||
* @typeParam KB - Which specific KillBehavior to test against. | ||
* @typeParam KB - Which specific KillBehavior type to test against. | ||
* @param killBehavior - Which kind of kill behavior to detect. | ||
@@ -24,0 +24,0 @@ * @param value - Any value. |
{ | ||
"name": "poolifier", | ||
"version": "2.4.7", | ||
"version": "2.4.8", | ||
"description": "A fast, easy to use Node.js Worker Thread Pool and Cluster Pool implementation", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
119508
1466