feat(sourcemaps-reader): support shutdown

feat(assist): support shutdown
feat(peers): support shutdown
This commit is contained in:
Taha Yassine Kraiem 2022-10-24 17:29:03 +02:00
parent eb7c2b15db
commit 2a514da536
3 changed files with 35 additions and 2 deletions

View file

@ -112,4 +112,21 @@ if (process.env.uws !== "true") {
// process.exit(1);
});
module.exports = {uapp};
}
if (process.env.uws !== "true") {
wsapp.get('/private/shutdown', (req, res) => {
console.log("Requested shutdown");
res.statusCode = 200;
res.end("ok!");
process.kill(1, "SIGTERM");
}
);
} else {
uapp.get('/private/shutdown', (res, req) => {
console.log("Requested shutdown");
res.writeStatus('200 OK').end("ok!");
process.kill(1, "SIGTERM");
}
);
}

View file

@ -23,4 +23,12 @@ const server = app.listen(PORT, HOST, () => {
console.log(`SR App listening on http://${HOST}:${PORT}`);
console.log('Press Ctrl+C to quit.');
});
module.exports = {server};
module.exports = {server};
app.get('/private/shutdown', (req, res) => {
console.log("Requested shutdown");
res.statusCode = 200;
res.end("ok!");
process.kill(1, "SIGTERM");
}
);

View file

@ -31,4 +31,12 @@ const wsserver = wsapp.listen(PORT, HOST, () => {
});
wsapp.enable('trust proxy');
socket.start(wsserver);
module.exports = {wsserver};
module.exports = {wsserver};
wsapp.get('/private/shutdown', (req, res) => {
console.log("Requested shutdown");
res.statusCode = 200;
res.end("ok!");
process.kill(1, "SIGTERM");
}
);