Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// if already quitting then force quit
if (quitting) {
console.log('forcing quit now');
process.exit();
}
await quit();
});
try {
console.log('worker initializing');
db = new Database(databaseConfig);
await db.connect();
console.log('connected to database');
consumer = new Consumer('queue', queueConfig);
consumer.on('error', err => {
console.log(err.message);
process.exit(1);
});
await new Promise(resolve => {
consumer.on('ready', async() => {
resolve();
});
});
console.log('connected to queue');
console.log('worker initialized');
} catch (err) {
console.log(err);
process.exit(1);
}