cluster.disconnect([callback])
callback
<Function> 当所有工作进程断开连接并关闭句柄时调用。
对 cluster.workers
中的每个工作进程调用 .disconnect()
。
当它们断开连接时,所有的内部句柄都将关闭,如果没有其他事件在等待,则允许主进程正常终止。
该方法采用可选的回调参数,当完成时将被调用。
这只能从主进程调用。
callback
<Function> Called when all workers are disconnected and handles are closed.
Calls .disconnect()
on each worker in cluster.workers
.
When they are disconnected all internal handles will be closed, allowing the master process to die gracefully if no other event is waiting.
The method takes an optional callback argument which will be called when finished.
This can only be called from the master process.