The configuration for the constructor.
The number of cores to allocate for the worker pool.
The logger instance for logging messages.
The manifest containing method definitions.
The factory for creating worker instances.
Protected
loggerMethods exposes a fully typed interface for making calls using workers. It provides all the available methods provided by the manifest with proper types applied.
Protected
poolProcesses a worker task by enqueuing it for execution.
The information about the worker task to be executed.
A promise that resolves with the result of the worker task execution.
Destroys the WorkerManager instance and terminates its associated pool.
Optional
params: { An optional configuration object.
Optional
force?: booleanIndicates whether to forcefully terminate the pool.
A promise that resolves when the destruction process is complete.
Enqueues a task to be processed by the worker pool.
The task to be processed by the worker pool.
A promise that resolves with the result of the task or rejects with an error if the task fails or cannot be processed.
Static
createCreates and initializes a new instance of WorkerManager.
The configuration options for the WorkerManager.
Optional
cores?: numberThe number of cores to allocate for workers. Defaults to 1.
Optional
logger?: LoggerThe manifest defining the worker capabilities and operations.
The factory for creating workers.
A promise that resolves to a new WorkerManager instance.
Generated using TypeDoc
Constructs a new instance of the class using the provided parameters.