1 Commits

Author SHA1 Message Date
3c020d25ed feat: handle termination 2019-01-30 09:51:31 -07:00

View File

@@ -43,12 +43,12 @@ async function run() {
await fetchAndIndex().catch(handleError);
// listen for termination
const terminate = type => () => {
console.log(`Terminating [${type}]`);
const terminate = () => {
console.log('Terminating...');
process.exit(0);
};
process.on('SIGINT', terminate('SIGINT'));
process.on('SIGTERM', terminate('SIGTERM'));
process.on('SIGINT', terminate);
process.on('SIGTERM', terminate);
// scheduled running
if (interval === 0) return;