Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/poolifier/src/mod.ts>IWorkerChoiceStrategy

Fast and small web worker pool
Latest
interface IWorkerChoiceStrategy
import { type IWorkerChoiceStrategy } from "https://deno.land/x/poolifier@v0.3.14/src/mod.ts";

Worker choice strategy interface.

Properties

readonly
strategyPolicy: StrategyPolicy

Strategy policy.

readonly
taskStatisticsRequirements: TaskStatisticsRequirements

Tasks statistics requirements.

readonly
reset: () => boolean

Resets strategy internals.

readonly
update: (workerNodeKey: number) => boolean

Updates the worker node key strategy internals. This is called after a task has been executed on a worker node.

readonly
choose: () => number | undefined

Chooses a worker node in the pool and returns its key. If no worker nodes are not eligible, undefined is returned. If undefined is returned, the caller retry.

readonly
remove: (workerNodeKey: number) => boolean

Removes the worker node key from strategy internals.

readonly
setOptions: (opts: WorkerChoiceStrategyOptions | undefined) => void

Sets the worker choice strategy options.