Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

documenting cluster.setupMaster

  • Loading branch information...
commit 0c31dba5cab6db9fad4627aa4bdbf88cd0651ffc 1 parent 21f5e9b
Andreas Madsen authored January 05, 2012

Showing 1 changed file with 34 additions and 0 deletions. Show diff stats Hide diff stats

  1. 34  doc/api/cluster.markdown
34  doc/api/cluster.markdown
Source Rendered
@@ -101,6 +101,40 @@ This can be used to restart the worker by calling `fork()` again.
101 101
       cluster.fork();
102 102
     });
103 103
 
  104
+### Event 'setup'
  105
+
  106
+When the `.setupMaster()` function has been executed this event emits. If `.setupMaster()`
  107
+was not executed before `fork()` or `.autoFork()`, they will execute the function with no
  108
+arguments.
  109
+
  110
+### cluster.setupMaster([options])
  111
+
  112
+The `setupMaster` is used to change the default 'fork' behavior. It takes one option
  113
+object argument.
  114
+
  115
+Example:
  116
+
  117
+    var cluster = require("cluster");
  118
+    cluster.setupMaster({
  119
+      exec : "worker.js",
  120
+      args : ["--use", "https"],
  121
+      silent : true
  122
+    });
  123
+    cluster.autoFork();
  124
+
  125
+The options argument can contain 3 different properties.
  126
+
  127
+- `exec` are the file path to the worker file, by default this is the same file as the master.
  128
+- `args` are a array of arguments send along with the worker, by default this is `process.argv.slice(2)`.
  129
+- `silent`, if this option is true the output of a worker won't propagate to the master, by default this is false.
  130
+
  131
+### cluster.settings
  132
+
  133
+All settings set by the `.setupMaster` is stored in this settings object.
  134
+This object is not supposed to be change or set manually, by you.
  135
+
  136
+All propertys are `undefined` if they are not yet set.
  137
+
104 138
 ### cluster.fork([env])
105 139
 
106 140
 Spawn a new worker process. This can only be called from the master process.

0 notes on commit 0c31dba

Please sign in to comment.
Something went wrong with that request. Please try again.