cluster.disconnect([callback])


  • callback <Function> 当所有工作进程断开连接并关闭句柄时调用。

    ¥callback <Function> Called when all workers are disconnected and handles are closed.

cluster.workers 中的每个工作进程调用 .disconnect()

¥Calls .disconnect() on each worker in cluster.workers.

当它们断开连接时,所有的内部句柄都将关闭,如果没有其他事件在等待,则允许主进程正常终止。

¥When they are disconnected all internal handles will be closed, allowing the primary 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 primary process.