1 import type { AbstractPoolWorker
} from
'../abstract-pool-worker'
4 * Enumeration of worker choice strategies.
6 export const WorkerChoiceStrategies
= Object.freeze({
8 * Round robin worker selection strategy.
10 ROUND_ROBIN
: 'ROUND_ROBIN',
12 * Less recently used worker selection strategy.
14 LESS_RECENTLY_USED
: 'LESS_RECENTLY_USED'
18 * Worker choice strategy.
20 export type WorkerChoiceStrategy
= keyof
typeof WorkerChoiceStrategies
23 * Worker choice strategy interface.
25 * @template Worker Type of worker which manages the strategy.
27 export interface IWorkerChoiceStrategy
<Worker
extends AbstractPoolWorker
> {
29 * Is the pool attached to the strategy dynamic?.
31 isDynamicPool
: boolean
33 * Choose a worker in the pool.