-
Notifications
You must be signed in to change notification settings - Fork 30k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
src: setup cluster workers before preloading
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: #1269 PR-URL: #1314 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Fedor Indutny <fedor@indutny.com>
- Loading branch information
1 parent
65d4d25
commit b6e22c4
Showing
4 changed files
with
29 additions
and
10 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
}); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
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