Reputation: 10102
The cluster
modules in nodejs has the exit
, disconnect
, and death
events. Which functions should the worker invoke in order to issue such events?
I have tried cluster.worker.X()
where X is either close
, end
, diconnect
, etc.
with the same breath, how to issue end
event for the http.createServer()
?
thanks
Upvotes: 0
Views: 1942
Reputation: 3915
I don't believe these events should be invoked directly. They exists for us to be able to react to events in the lifecycle of the cluster. Here's how to indirectly invoke them:
exit
// from the worker
process.exit()
disconnect
// from the master
var worker = cluster.fork()
worker.disconnect()
death (deprecated)
Renamed to 'exit' in v0.8.0 (see above).
Upvotes: 1