*/
export type WorkerChoiceStrategy = keyof typeof WorkerChoiceStrategies
+/**
+ * Worker choice strategy options.
+ */
+export interface WorkerChoiceStrategyOptions {
+ /**
+ * Use tasks median run time instead of average run time.
+ */
+ medRunTime?: boolean
+}
+
/**
* Pool worker tasks usage statistics requirements.
*/
export interface RequiredStatistics {
runTime: boolean
avgRunTime: boolean
+ medRunTime: boolean
}
/**
*/
export interface IWorkerChoiceStrategy {
/**
- * Is the pool bound to the strategy dynamic?.
- */
- readonly isDynamicPool: boolean
- /**
- * Required pool tasks usage statistics.
+ * Required tasks usage statistics.
*/
readonly requiredStatistics: RequiredStatistics
/**
*/
reset: () => boolean
/**
- * Chooses a worker in the pool and returns its key.
+ * Chooses a worker node in the pool and returns its key.
*/
choose: () => number
/**
- * Removes a worker reference from strategy internals.
+ * Removes a worker node key from strategy internals.
*
- * @param workerKey - The worker key.
+ * @param workerNodeKey - The worker node key.
*/
- remove: (workerKey: number) => boolean
+ remove: (workerNodeKey: number) => boolean
}