worker.kill([signal])
signal
<string> 发送给工作进程的终止信号的名称。 默认值:'SIGTERM'
此函数会杀死工作进程。
在主工作进程中,它通过断开 worker.process
来完成此操作,一旦断开连接,就使用 signal
终止。
在工作进程中,它通过使用 signal
终止进程来实现。
kill()
函数在不等待正常断开连接的情况下杀死工作进程,它与 worker.process.kill()
具有相同的行为。
为了向后兼容,此方法别名为 worker.destroy()
。
在工作进程中,process.kill()
是存在的,但不是这个函数;它是 kill()
。
signal
<string> Name of the kill signal to send to the worker process. Default:'SIGTERM'
This function will kill the worker. In the primary worker, it does this by
disconnecting the worker.process
, and once disconnected, killing with
signal
. In the worker, it does it by killing the process with signal
.
The kill()
function kills the worker process without waiting for a graceful
disconnect, it has the same behavior as worker.process.kill()
.
This method is aliased as worker.destroy()
for backwards compatibility.
In a worker, process.kill()
exists, but it is not this function;
it is kill()
.