thisandagain/fork-pool — pull request #2 by Redsandro (2014-09-23 13:25:58+00:00)
Title: Workaround for main process debugging option

This fixes https://github.com/thisandagain/fork-pool/issues/1

Using `node --debug .` causes the app to debug on the default debugging port `5858`. But all the forked processes will have the same option, causing all children to fail to start:

_Failed to open socket on port 5859, waiting 1000 ms before retrying_

This workaround fixes that by disabling the debugging. Optionally enable debugging by assigning an increasing port number for debugging.

* Starting port (that the parent uses) needs to be known.
* The incremental value needs to be part of `this` so I added the settings to the pool object.
* Ports need to be assigned regardless of detection of `--debug` because instances are forked quicker than the changes register, so I added a boolean to the settings.