Simple worker threads pool using Node's worker_threads module.
npm install @wac/worker-threads-pool
opt
<Object>
size
<Number>
Number of workerstask
<String>
A absolute path of worker fileworkerData
<Any>
Data to pass into workersresourceLimits
<Object>
Resource constraints inside workers
param
<Any>
The param your worker script needtimeout
<Number>
Timeout in milisecond for limiting the execution time. When timeout, the function will throw a TimeoutError, use isTimeoutError function to detect it.- Returns:
<Promise>
Call worker.terminate()
for every worker in the pool and release them.