Handle SIGHUP gracefully

Invoke shutdown instead of exiting immediately when SIGHUP is received,
and do the same on both slave and master for signals received.
This commit is contained in:
Hornwitser committed 2021-02-17 17:49:54 +01:00
1 parent 4ca092f351
commit 9660fa0801
2 files changed
+7 -7

No files matched your search

+5 -1
View File
@@ -1633,7 +1633,7 @@ async function startSlave() {
process.on("SIGTERM", () => {
if (secondSigterm) {
setBlocking(true);
logger.fatal("Caught second termination signal, terminating immediately");
logger.fatal("Caught second termination, terminating immediately");
// eslint-disable-next-line no-process-exit
process.exit(1);
}
@@ -1642,6 +1642,10 @@ async function startSlave() {
logger.info("Caught termination signal, shutting down");
slave.shutdown();
});
process.on("SIGHUP", () => {
logger.info("Terminal closed, shutting down");
slave.shutdown();
});
slaveConnector.once("connect", () => {
logger.add(new libLoggingUtils.LinkTransport({ link: slave }));