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

Infinite worker with onProgress stuff #30

Closed darky closed 5 years ago

darky commented 5 years ago

Would be cool to have worker, which will run infinitely and pass back some chunk of data via stream/observable/callback or something else.

wilk commented 5 years ago

Workers already go on until you force the shutdown (https://wilk.github.io/microjob/GUIDE.html#worker-pool). However, microjob has been built to provide an easy way to execute inline functions in background. I think your case is more achievable through native worker threads (they use events API instead of promises).

In any case, an "onProgress" event should be fired by yourself because you and only you know when exactly the job ends.

wilk commented 5 years ago

I'm closing this due to inactivity.