Thread
Thread Pool using appolo-thread and node worker_threads
Installation#
Options#
| key | Description | Type | Default |
|---|---|---|---|
id | poolProvider injection id | string | poolProvider |
threads | number of threads per pool | number | 1 |
maxThreadJobs | max running jobs pre thread | number | infinite |
in config/modules/all.ts
Usage#
Run#
First we create worker thread.
worker class must inherit from Worker.
now we can inject poolProvider and run our worker
Message event#
The message event emitted from the worker using the worker postMessage method
post message in worker class
Uncaught event#
The error event emitted if the worker thread throws an uncaught exception.