import { AbstractWorkerChoiceStrategy } from './abstract-worker-choice-strategy'
import type {
IWorkerChoiceStrategy,
+ StrategyPolicy,
WorkerChoiceStrategyOptions
} from './selection-strategies-types'
* Selects the next worker in a round robin fashion.
*
* @typeParam Worker - Type of worker which manages the strategy.
- * @typeParam Data - Type of data sent to the worker. This can only be serializable data.
- * @typeParam Response - Type of execution response. This can only be serializable data.
+ * @typeParam Data - Type of data sent to the worker. This can only be structured-cloneable data.
+ * @typeParam Response - Type of execution response. This can only be structured-cloneable data.
*/
export class RoundRobinWorkerChoiceStrategy<
Worker extends IWorker,
>
extends AbstractWorkerChoiceStrategy<Worker, Data, Response>
implements IWorkerChoiceStrategy {
- /**
- * Id of the next worker node.
- */
- private nextWorkerNodeId: number = 0
+ /** @inheritDoc */
+ public readonly strategyPolicy: StrategyPolicy = {
+ useDynamicWorker: true
+ }
/** @inheritDoc */
public constructor (
opts: WorkerChoiceStrategyOptions = DEFAULT_WORKER_CHOICE_STRATEGY_OPTIONS
) {
super(pool, opts)
- this.checkOptions(this.opts)
+ this.setTaskStatisticsRequirements(this.opts)
}
/** @inheritDoc */