API

Class AutoReleaseWorkerPool

Similar to the WorkerPool class except it creates and destroys workers automatically with a maximum of maxWorkers workers. Workers are terminated when it is idle for at least idleTimeElapsedBeforeRelease milliseconds.

Hierarchy (View Summary)

Index
DefaultOptions: AutoReleaseWorkerPoolOptions = ...

Default options for the constructor. Override to change the defaults.

  • Pushes an action to the worker pool. If all the workers are active, the action will be pended until a worker has completed its action.

    Parameters

    • action: (worker: Worker, onComplete: () => void) => void

      The action to perform. Call onComplete when the action is complete.

    Returns void