瀏覽代碼

Improve error handling in streaming/index.js (#5968)

On an unhandled worker exception, we should log the exception
and exit with nonzero status, instead of letting workers
silently fail and restarting them in an endless loop.

Note: we previously tried to handle the `'error'` signal.
That's not a signal Node fires; my patch traps `'uncaughtException'`,
which is what the code was _trying_ to do.
master
erin 6 年之前
committed by Eugen Rochko
父節點
當前提交
c986218c3a
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. +3
    -1
      streaming/index.js

+ 3
- 1
streaming/index.js 查看文件

@@ -563,12 +563,14 @@ const startWorker = (workerId) => {

const onError = (err) => {
log.error(err);
server.close();
process.exit(0);
};

process.on('SIGINT', onExit);
process.on('SIGTERM', onExit);
process.on('exit', onExit);
process.on('error', onError);
process.on('uncaughtException', onError);
};

throng({


Loading…
取消
儲存