Notif process also in cron
This commit is contained in:
parent
a208eb7ea1
commit
3d059287ae
3 changed files with 167 additions and 136 deletions
|
|
@ -4,6 +4,8 @@
|
|||
import { Meteor } from 'meteor/meteor';
|
||||
import { tweetIberiaFires, tweetEuropeFires } from '/imports/api/ActiveFires/server/tweetFiresInZone';
|
||||
import { isMailServerMaster, sendEmailsFromQueue } from '/imports/startup/server/email';
|
||||
import Notifications from '/imports/api/Notifications/Notifications';
|
||||
import processNotif from '/imports/modules/server/notificationsProcess.js';
|
||||
|
||||
// https://github.com/thesaucecode/meteor-synced-cron/
|
||||
|
||||
|
|
@ -44,7 +46,7 @@ Meteor.startup(() => {
|
|||
timezone: 'Europe/Madrid',
|
||||
schedule: (parser) => {
|
||||
// http://bunkat.github.io/later/
|
||||
const sched = parser.text('every 1 min');
|
||||
const sched = parser.text('every 10 min');
|
||||
if (sched.error !== -1) {
|
||||
console.error(`Mail cron 'when' field parsed with errors: ${sched.error}`);
|
||||
}
|
||||
|
|
@ -52,6 +54,24 @@ Meteor.startup(() => {
|
|||
},
|
||||
job: () => sendEmailsFromQueue()
|
||||
});
|
||||
|
||||
SyncedCron.add({
|
||||
name: 'Process pending notif',
|
||||
timezone: 'Europe/Madrid',
|
||||
schedule: (parser) => {
|
||||
// http://bunkat.github.io/later/
|
||||
const sched = parser.text('every 15 min');
|
||||
if (sched.error !== -1) {
|
||||
console.error(`Mail cron 'when' field parsed with errors: ${sched.error}`);
|
||||
}
|
||||
return sched;
|
||||
},
|
||||
job: () => {
|
||||
Notifications.find({ nofitied: null }).forEach((notif) => {
|
||||
processNotif(notif);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const esEn = Meteor.settings.private.twitter.es.enabled;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue