Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (silent) {
return createOrGetServer().close();
}
function gracefulExitCallback() {
if (config.get('cacheEnabled')) {
if (redisClient && redisClient.quit) {
redisClient.quit();
return process.exit(exitCode);
}
}
return process.exit(exitCode);
}
return gracefulExit.gracefulExitHandler(app, createOrGetServer(), {
log: true,
logger(data) {
return log.info(data);
},
suicideTimeout: 3 * 1000, // pm2 waits 4 seconds
exitProcess: false,
force: true,
callback: gracefulExitCallback
});
};
function closeServer(server, app) {
gracefulExit.init(server);
app.use(gracefulExit.middleware(app));
gracefulExit.gracefulExitHandler(app, server, {
exitProcess: false
});
}