From 8c3d55dec1206d853c7720eb92c59ad40d32b617 Mon Sep 17 00:00:00 2001 From: jusax23 Date: Sat, 23 Oct 2021 12:30:10 +0200 Subject: [PATCH] saveShutdown methode --- manager.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/manager.js b/manager.js index f72847f..8eff7b6 100644 --- a/manager.js +++ b/manager.js @@ -66,6 +66,18 @@ const manager = function(process){ mayShutdown(); }); }; - + t.saveShutdown = function(){ + return new Promise((res,rej)=>{ + t.shutdown().then(()=>{ + setTimeout(function() { //some save time + process.exit(); + }, 1000); + }).catch(()=>{ + setTimeout(function() { //shutdown on error with more save time + process.exit(); + }, 10000); + }); + }); + } } export default manager;