Added node schedule to run crawler and notification service
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
|
||||
const Promise = require("bluebird");
|
||||
const db = require("../models/index");
|
||||
const { allMarketAlerts } = require('../helpers/db/dbHelper');
|
||||
const { createMarketAlertEmailTemplate, sendBulkEmail } = require('../helpers/awsEmail');
|
||||
@@ -16,18 +15,15 @@ async function processNotifications() {
|
||||
await sendBulkEmail(marketAlerts);
|
||||
} else {
|
||||
console.log("NOTIFICATION SERVICE: No new alerts");
|
||||
process.exit();
|
||||
}
|
||||
|
||||
await db.MarketAlert.update(
|
||||
{ notified: true }, /* set attributes' value */
|
||||
{ where: { notified: false } } /* where criteria */
|
||||
);
|
||||
process.exit();
|
||||
} catch (e) {
|
||||
console.log("NOTIFICATION SERVICE: could not send notifications reason: ", e);
|
||||
process.exit();
|
||||
}
|
||||
}
|
||||
|
||||
processNotifications();
|
||||
module.exports = processNotifications;
|
||||
|
||||
Reference in New Issue
Block a user