Thread
Thread Pool using appolo-thread and node worker_threads
#
Installation#
Optionskey | 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#
RunFirst we create worker thread.
worker class must inherit from Worker
.
now we can inject poolProvider and run our worker
#
Message eventThe message
event emitted from the worker using the worker postMessage
method
post message in worker class
#
Uncaught eventThe error
event emitted if the worker thread throws an uncaught exception.