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