server.close() vs process.disconnect()

Viewed 20

I am currently using cluster in my node.js application but have a bit of confusion on gracefully exiting the server.

Previously I was using just a single process, so in the 'uncaughtException' handler I call server.close(), which stops all incoming requests, then I also set up a timer for about 10 seconds, after that I call process.exit() to kill the server.

Now with cluster, each child process is created with an IPC channel, and calling process.disconnect() seems to do exactly the same thing as what I described for the single node process.

My question is, when using cluster and if I want to gracefully exit the service, what should I do? seems like process.disconnect() is good enough?

0 Answers
Related