bullmq
bullmq copied to clipboard
Option not to reuse child process
Is your feature request related to a problem? Please describe. When we started using bullmq to process jobs, we thought it would spawn a child process for each job. But we realised it does not...
Describe the solution you'd like This would bring the advantage of not risking to have a memory leak induced by a dependency, as the child process memory would be released after each job.
Describe alternatives you've considered We have patched it to exit the child process after each job, but it would be nice to have it as an official worker option
Additional context
Yes, the reason why it reuses the process is because it is slow to spawn a new process for every job. If you already have a solution it would be great if you could contribute with a patch, as long as the default stays the same as today it would work.
I have noticed an issue regarding memory leak. Where services increase in memory, till NodeJS restarts, due to OOM.