Access to internal workers array
Closed this issue · 2 comments
asafyish commented
Hi,
It's not possible to do logging correctly without.
The problem is, each worker trying to log to the same file will fail because the file is locked.
The solution is to allow the cluster file do all the logging, but for that, he need to listen on the workers stdout and stderr.
spion commented
You can use cluster.on('online', function(worker) { ... })
to access each worker as it becomes ready and attach any listeners you like. The events are not documented yet, but I plan to add the docs soon.
Let me know if this works for you
spion commented
This is now also available via cluster.workers()