Cluster Manager
start(options, [startFunction], [masterFunction])
There are two ways of using this. If you supply a startFunction, invoke this from your start file. The startFunction will be called when the process is not the master. If startFunction is not supplied, this method should only be called when Cluster.isMaster is true, and it is up to the invoker to handle the non-master case.
Kind: global function
Param | Type | Description | |
---|---|---|---|
options | object | the options for the cluster manager | |
[options.count] | int | number of child processes to start. If not set, This will use the env variable CM_MAX_CHILD_PROCESSES or MAX_CHILD_PROCESSES or 32 clamped to the number of cpus to determine the number of child processes to start | |
[options.autoRestart] | boolean | If true, cluster manager will restart a child on exit (default true) | |
options.webServerPort | false \ | int | if a port is supplied this will start a web server |
[options.webServerSetup] | function | optional function to configure the express server | |
[options.adjustRootStatus] | function | a optional intercept to allow you to change the status object returned by hitting the webServer root | |
options.sendStatusOnRestart | boolean | If true, sends the last status reported by a child to its reforked replacement (default true) | |
options.updateStatusMs | int | If startFunction is supplied, this is used when connecting to the parent process to define the status update rate. | |
[startFunction] | function | the function used to start the child processes. It is only invoked on child processes | |
[masterFunction] | function | this will be called if the process is the master |