I’m looking to use worker threads to do some batch processing and still have the main node thread be responsive so it does not block the main thread. I was wondering if there are any hints on how to do this with the latest node version. I read the docs on web_workers. The entry point requires specifying a .js file to run. Meteor does a bunch of packaging for the source files. Is there any file entry point I can use to access server side code so I can run some functions as worker_threads?
All the articles I read were dated (pre web_worker support in node)
It’s the same issue with service workers. Meteor doesn’t support having the multiple entry points this would require unfortunately. But you could create a worker as a standalone in the private/ directory and import it there.
Thanks for this! It works really well in general. Problem I’ve ran into is when the thread wants to use a third party module. It works in development mode but on a built node app it no longer works because of the custom module resolution that Meteor does.