mirror of https://github.com/lukechilds/node.git
Browse Source
We need to process cluster workers before any preload modules is executed. Otherwise, the child processes are not correctly disovered as clustered workers inside the preloaded modules. Fixes: https://github.com/iojs/io.js/issues/1269 PR-URL: https://github.com/iojs/io.js/pull/1314 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Fedor Indutny <fedor@indutny.com>v1.8.0-commit
Ali Ijaz Sheikh
10 years ago
committed by
Ben Noordhuis
4 changed files with 29 additions and 10 deletions
@ -0,0 +1,7 @@ |
|||||
|
var cluster = require('cluster'); |
||||
|
if (cluster.isMaster) { |
||||
|
cluster.fork(); // one child
|
||||
|
cluster.on('exit', function(worker, code, signal) { |
||||
|
console.log('worker terminated with code ' + code); |
||||
|
}); |
||||
|
} |
@ -0,0 +1,3 @@ |
|||||
|
var cluster = require('cluster'); |
||||
|
cluster.isMaster || process.exit(42 + cluster.worker.id); // +42 to distinguish
|
||||
|
// from exit(1) for other random reasons
|
Loading…
Reference in new issue