提交 2b24c8d3 authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo

Probably fix the issue in which the mediasoup-worker process sometimes remains…

Probably fix the issue in which the mediasoup-worker process sometimes remains alive once the main process dies.
上级 4b51a47e
......@@ -97,26 +97,21 @@ class Worker extends EventEmitter
// Close every Room
this._rooms.forEach((room) => room.close(undefined, true));
// Kill mediasoup-worker process (let it some time so previous
// requests are properly sent and replied)
setTimeout(() =>
// Kill mediasoup-worker process
if (this._child)
{
// Kill child
if (this._child)
{
// Remove event listeners but leave a fake 'error' hander
// to avoid propagation
this._child.removeAllListeners('exit');
this._child.removeAllListeners('error');
this._child.on('error', () => null);
this._child.kill('SIGTERM');
}
this._child = null;
// Close the Channel instance
this._channel.close();
}, 100);
// Remove event listeners but leave a fake 'error' hander
// to avoid propagation
this._child.removeAllListeners('exit');
this._child.removeAllListeners('error');
this._child.on('error', () => null);
this._child.kill('SIGTERM');
}
this._child = null;
// Close the Channel instance
this._channel.close();
this.emit('close', error);
}
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论