Make percentage-getting easier
This commit is contained in:
parent
755afdda01
commit
abcb7a5314
6
index.js
6
index.js
|
@ -90,14 +90,14 @@ process.on("exit", (code) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
// just in case some user like using "kill"
|
// just in case some user like using "kill"
|
||||||
process.on("SIGTERM", (signal) => {
|
process.on("SIGTERM", () => {
|
||||||
console.log("Saving DB");
|
console.log("Saving DB");
|
||||||
saveAndCleanup();
|
saveAndCleanup();
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
// catch ctrl-c, so that event 'exit' always works
|
// catch ctrl-c, so that event 'exit' always works
|
||||||
process.on("SIGINT", (signal) => {
|
process.on("SIGINT", () => {
|
||||||
console.log("Saving DB");
|
console.log("Saving DB");
|
||||||
saveAndCleanup();
|
saveAndCleanup();
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
|
@ -105,7 +105,7 @@ process.on("SIGINT", (signal) => {
|
||||||
|
|
||||||
// what about errors
|
// what about errors
|
||||||
// try remove/comment this handler, 'exit' event still works
|
// try remove/comment this handler, 'exit' event still works
|
||||||
process.on("uncaughtException", (err) => {
|
process.on("uncaughtException", () => {
|
||||||
console.log("Saving DB");
|
console.log("Saving DB");
|
||||||
saveAndCleanup();
|
saveAndCleanup();
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
|
|
Loading…
Reference in New Issue