+import { DEFAULT_WORKER_CHOICE_STRATEGY_OPTIONS } from '../../utils'
+import type { IPool } from '../pool'
import type { IWorker } from '../worker'
import { AbstractWorkerChoiceStrategy } from './abstract-worker-choice-strategy'
-import type { IWorkerChoiceStrategy } from './selection-strategies-types'
+import type {
+ IWorkerChoiceStrategy,
+ 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 response of execution. This can only be serializable data.
+ * @typeParam Response - Type of execution response. This can only be serializable data.
*/
export class RoundRobinWorkerChoiceStrategy<
Worker extends IWorker,
*/
private nextWorkerNodeId: number = 0
+ /** @inheritDoc */
+ public constructor (
+ pool: IPool<Worker, Data, Response>,
+ opts: WorkerChoiceStrategyOptions = DEFAULT_WORKER_CHOICE_STRATEGY_OPTIONS
+ ) {
+ super(pool, opts)
+ this.checkOptions(this.opts)
+ }
+
/** @inheritDoc */
public reset (): boolean {
this.nextWorkerNodeId = 0