-import type { AbstractPoolWorker } from '../abstract-pool-worker'
import type { IPoolInternal } from '../pool-internal'
import { PoolType } from '../pool-internal'
+import type { IPoolWorker } from '../pool-worker'
import { DynamicPoolWorkerChoiceStrategy } from './dynamic-pool-worker-choice-strategy'
import type {
IWorkerChoiceStrategy,
* @template Response Type of response of execution. This can only be serializable data.
*/
export class WorkerChoiceStrategyContext<
- Worker extends AbstractPoolWorker,
+ Worker extends IPoolWorker,
Data,
Response
> {
}
/**
- * Get the worker choice strategy instance specific to the pool type.
+ * Gets the worker choice strategy instance specific to the pool type.
*
* @param workerChoiceStrategy The worker choice strategy.
* @returns The worker choice strategy instance for the pool type.
}
/**
- * Get the worker choice strategy used in the context.
+ * Gets the worker choice strategy used in the context.
*
* @returns The worker choice strategy.
*/
}
/**
- * Set the worker choice strategy to use in the context.
+ * Sets the worker choice strategy to use in the context.
*
* @param workerChoiceStrategy The worker choice strategy to set.
*/
public setWorkerChoiceStrategy (
workerChoiceStrategy: WorkerChoiceStrategy
): void {
+ this.workerChoiceStrategy?.reset()
this.workerChoiceStrategy = this.getPoolWorkerChoiceStrategy(
workerChoiceStrategy
)
}
/**
- * Choose a worker with the underlying selection strategy.
+ * Chooses a worker with the underlying selection strategy.
*
* @returns The chosen one.
*/