wilk / microjob

A tiny wrapper for turning Node.js worker threads into easy-to-use routines for heavy CPU loads.
https://wilk.github.io/microjob/
MIT License
2.02k stars 47 forks source link

ability to spawn own worker.js with shared workerData #39

Closed Ar4ics closed 5 years ago

Ar4ics commented 5 years ago

something like await start({ maxWorkers: AVAILABLE_CPUS }, workerPath, workerData);

wilk commented 5 years ago

The start function is used to launch the Worker Pool, not to spawn a new worker thread. To do that, you should use the job function but only for inline workers, not for separated files.

I think the native API fits better for your case: https://nodejs.org/api/worker_threads.html#worker_threads_new_worker_filename_options

Ar4ics commented 5 years ago

thanks