mirror of
https://gitlab.com/jusax23/dnc.git
synced 2024-11-22 14:46:33 +01:00
31 lines
608 B
JavaScript
31 lines
608 B
JavaScript
|
import dnc from "./manager.js";
|
||
|
|
||
|
const M = new dnc(process);
|
||
|
|
||
|
|
||
|
M.addShutdownTask(()=>{
|
||
|
return new Promise(function(res, rej) {
|
||
|
//do something with async
|
||
|
console.log("Shuting down async ...");
|
||
|
setTimeout(()=>{
|
||
|
console.log("async done");
|
||
|
res();
|
||
|
},5000);
|
||
|
|
||
|
});
|
||
|
},30000);//max time
|
||
|
|
||
|
M.addShutdownTask(()=>{
|
||
|
console.log("Shuting down sync");
|
||
|
},30000);//max time
|
||
|
|
||
|
M.shutdown().then(()=>{
|
||
|
setTimeout(function() { //some save time
|
||
|
process.exit();
|
||
|
}, 1000);
|
||
|
}).catch(()=>{
|
||
|
setTimeout(function() { //shutdown on error with more save time
|
||
|
process.exit();
|
||
|
}, 10000);
|
||
|
});
|