cluster: only forcibly exit worker on unclean exit
authorSam Roberts <sam@strongloop.com>
Tue, 3 Dec 2013 03:00:39 +0000 (19:00 -0800)
committerTimothy J Fontaine <tjfontaine@gmail.com>
Tue, 31 Dec 2013 19:43:43 +0000 (11:43 -0800)
commitdce35146e0e52de32c3836d01ada10f3ebbe8792
tree5567215aefdbb5ce1c042f4db740136f00195cc9
parent6f40abe2d445516de629d289afe21f458e7cc1e9
cluster: only forcibly exit worker on unclean exit

Fix inadvertent v0.11 changes to the definition of suicide, particularly
the relationship between suicide state, the disconnect event, and when
exit should occur.

In v0.10, workers don't forcibly exit on disconnect, it doesn't give
them time to do a graceful finish of open client connections, they exit
under normal node rules - when there is nothing left to do. But on
unexpected disconnect they do exit so the workers aren't left around
after the master.

Note that a test as-written was invalid, it failed against the v0.10
cluster API, demonstrating that it was an undocumented API change.
lib/cluster.js
test/simple/test-cluster-disconnect-idle-worker.js
test/simple/test-cluster-worker-forced-exit.js [new file with mode: 0644]
test/simple/test-cluster-worker-no-exit.js [new file with mode: 0644]