worker.process
所有的工作进程都是通过 child_process.fork()
来创建的,这个方法返回的对象被存储为 .process
。
在工作进程中, process
属于全局对象。
参见:子进程模块。
当 process
上发生 'disconnect'
事件,并且 .exitedAfterDisconnect
的值不是 true
时,工作进程会调用 process.exit(0)
。
这样就可以防止连接意外断开。
All workers are created using child_process.fork()
, the returned object
from this function is stored as .process
. In a worker, the global process
is stored.
See: Child Process module.
Workers will call process.exit(0)
if the 'disconnect'
event occurs
on process
and .exitedAfterDisconnect
is not true
. This protects against
accidental disconnection.