Skip to main content
The Deno 2 Release Candidate is here
Learn more
Latest
class WorkerChoiceStrategyContext
import { WorkerChoiceStrategyContext } from "https://deno.land/x/poolifier@v0.3.14/src/mod.ts";

The worker choice strategy context.

Constructors

new
WorkerChoiceStrategyContext()

Worker choice strategy context constructor.

Type Parameters

Worker extends IWorker
optional
Data = unknown
optional
Response = unknown

Properties

private
readonly
retries: number

The maximum number of worker choice strategy execution retries.

private
readonly
workerChoiceStrategies: Map<WorkerChoiceStrategy, IWorkerChoiceStrategy>

The worker choice strategy instances registered in the context.

retriesCount: number

The number of worker choice strategy execution retries.

Methods

private
executeStrategy(workerChoiceStrategy: IWorkerChoiceStrategy): number

Executes the given worker choice strategy.

execute(): number

Executes the worker choice strategy in the context algorithm.

Gets the strategy policy in the context.

Gets the worker choice strategy in the context task statistics requirements.

remove(workerNodeKey: number): boolean

Removes the worker node key from the worker choice strategy in the context.

setOptions(opts: WorkerChoiceStrategyOptions | undefined): void

Sets the worker choice strategies in the context options.

setWorkerChoiceStrategy(workerChoiceStrategy: WorkerChoiceStrategy): void

Sets the worker choice strategy to use in the context.

update(workerNodeKey: number): boolean

Updates the worker node key in the worker choice strategy in the context internals.