Class AutoReleaseWorkerPool
Hierarchy
- WorkerPool
- AutoReleaseWorkerPool
Index
Constructors
constructor
Constructor
Parameters
maxWorkers: number
createWorkerAsync: (() => Promise<Worker>)
Returns Promise<Worker>
Optional options: AutoReleaseWorkerPoolOptions
Returns AutoReleaseWorkerPool
Properties
Static Default OptionsSearch playground for DefaultOptions
Default options for the constructor. Override to change the defaults.
Methods
disposeSearch playground for dispose
Terminates all workers and clears any pending actions.
Returns void
pushSearch playground for push
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)
Parameters
worker: Worker
onComplete: (() => void)
Returns void
Returns void
Returns void
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 leastidleTimeElapsedBeforeRelease
milliseconds.