-
-
Save andrewrk/6212372 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var cluster = require('cluster'); | |
if (cluster.isMaster) { | |
cluster.fork(); | |
cluster.on('exit', function(worker, code, signal) { | |
console.log('Worker exited:', worker.process.pid); | |
}); | |
setTimeout(function () { | |
for (var id in cluster.workers) { | |
var worker = cluster.workers[id]; | |
process.kill(worker.pid, 'SIGUSR2'); | |
} | |
}, 2000); | |
} else { | |
process.on('SIGUSR2', function() { | |
//WHY DOES THIS NOT GET CALLED? http://nodejs.org/api/cluster.html | |
console.log('SIGUSR2 called', process.pid); | |
}); | |
console.log('Worker listening for SIGUSR2', process.pid); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment