Added node schedule to run crawler and notification service
This commit is contained in:
@@ -13,7 +13,7 @@ const crawlers = [
|
||||
async function crawlAll() {
|
||||
console.log("CRAWLER SERVICE: crawlAll");
|
||||
|
||||
Promise.map(crawlers, function (crawler) {
|
||||
return Promise.map(crawlers, function (crawler) {
|
||||
return crawler.crawl();
|
||||
}).then(async (results) => {
|
||||
|
||||
@@ -51,17 +51,14 @@ async function crawlAll() {
|
||||
console.log("CRAWLER SERVICE: Number of new crawler results: " + filteredMarketAlerts.length);
|
||||
|
||||
await db.MarketAlert.bulkCreate(filteredMarketAlerts);
|
||||
process.exit();
|
||||
|
||||
} catch (e) {
|
||||
console.log("CRAWLER SERVICE: Could not bulkCreate marketalers reason: ", e);
|
||||
process.exit();
|
||||
}
|
||||
} catch (e) {
|
||||
console.log("CRAWLER SERVICE: Error crawling. Trying next crawler! ", e);
|
||||
process.exit();
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
crawlAll();
|
||||
module.exports = crawlAll;
|
||||
// crawlAll();
|
||||
|
||||
Reference in New Issue
Block a user