Forked from sam-github/cluster-disconnect-message.js
Last active
August 29, 2015 14:11
-
-
Save thelinuxlich/f9d34b77e09878b19948 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() | |
.on('online', function() { | |
this.disconnect(); | |
}); | |
} else { | |
process.on('internalMessage', function(msg) { | |
console.log('internalMsg', msg); | |
if(msg && msg.cmd && msg.cmd === 'NODE_CLUSTER_disconnect') { | |
// v0.10 | |
console.log('disconnect request!'); | |
} | |
if(msg && msg.cmd && msg.cmd === 'NODE_CLUSTER' && msg.act === 'disconnect') { | |
// v0.11 | |
console.log('disconnect request!'); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment