mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-12 23:04:52 +09:00
Added term signal handling to slave process
This commit is contained in:
1 parent
40bd3edb32
commit
c101fa7a32
1 file changed
+13
@@ -1625,6 +1625,19 @@ async function startSlave() {
|
||||
logger.info("Caught interrupt signal, shutting down");
|
||||
slave.shutdown();
|
||||
});
|
||||
let secondSigterm = false;
|
||||
process.on("SIGTERM", () => {
|
||||
if (secondSigterm) {
|
||||
setBlocking(true);
|
||||
logger.fatal("Caught second termination signal, terminating immediately");
|
||||
// eslint-disable-next-line no-process-exit
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
secondSigterm = true;
|
||||
logger.info("Caught termination signal, shutting down");
|
||||
slave.shutdown();
|
||||
});
|
||||
|
||||
slaveConnector.once("connect", () => {
|
||||
logger.add(new libLoggingUtils.LinkTransport({ link: slave }));
|
||||
|
||||
Reference in new issue
Block a user