Compare commits
1 Commits
e644475fbc
...
7bbe31f4ea
| Author | SHA1 | Date | |
|---|---|---|---|
| 7bbe31f4ea |
@@ -42,6 +42,15 @@ async function run() {
|
||||
// initial kickoff
|
||||
await fetchAndIndex().catch(handleError);
|
||||
|
||||
// listen for termination
|
||||
const terminate = type => () => {
|
||||
console.log(`Terminating [${type}]`);
|
||||
process.exit(0);
|
||||
};
|
||||
process.on('SIGINT', terminate('SIGINT'));
|
||||
process.on('SIGTERM', terminate('SIGTERM'));
|
||||
process.on('SIGKILL', terminate('SIGKILL'));
|
||||
|
||||
// scheduled running
|
||||
if (interval === 0) return;
|
||||
logger.debug(`Starting interval (${interval}s)...`);
|
||||
|
||||
Reference in New Issue
Block a user