For me, what would make respawn even more nicer is not only support fork mode, but cluster mode as well. Something like,
var respawn = require('respawn');
var monitor = respawn(['node', 'server.js'], {
env: {ENV_VAR:'test'},
cwd: '.',
mode: 'cluster', // 'fork' or 'cluster' mode, 'fork' default
instances: 2, // int specifying number of cluster instances, 'max` default
maxRestarts:10,
sleep:1000,
});
monitor.start(); // spawn and watch
I'm happy to contribute that feature if you think it's applicable and we can discuss some details :)
For me, what would make
respawneven more nicer is not only supportforkmode, butclustermode as well. Something like,I'm happy to contribute that feature if you think it's applicable and we can discuss some details :)