Cron tweet tasks enabled/disabled

This commit is contained in:
vjrj 2018-04-01 16:37:59 +02:00
parent 21531d1fd2
commit 4dfdd48e6a
2 changed files with 41 additions and 30 deletions

View file

@ -36,6 +36,10 @@ Meteor.startup(() => {
// collectionTTL: 172800 // collectionTTL: 172800
}); });
const esEn = Meteor.settings.private.twitter.es.enabled;
const enEn = Meteor.settings.private.twitter.en.enabled;
if (esEn) {
SyncedCron.add({ SyncedCron.add({
name: 'Check for fires stats in Spain and tweet about', name: 'Check for fires stats in Spain and tweet about',
timezone: 'Europe/Madrid', timezone: 'Europe/Madrid',
@ -63,7 +67,9 @@ Meteor.startup(() => {
* return numbersCrunched; * return numbersCrunched;
return tweetFires(); */ return tweetFires(); */
}); });
}
if (enEn) {
SyncedCron.add({ SyncedCron.add({
name: 'Check for fires stats in Europe and tweet about', name: 'Check for fires stats in Europe and tweet about',
timezone: 'Europe/Madrid', timezone: 'Europe/Madrid',
@ -76,6 +82,9 @@ Meteor.startup(() => {
}, },
job: () => tweetEuropeFires() job: () => tweetEuropeFires()
}); });
}
if (esEn || enEn) {
SyncedCron.start(); SyncedCron.start();
}
}); });

View file

@ -33,6 +33,7 @@
"ironPassword": "SomePasswordAlLeast32LongYouKnowHowToCount", "ironPassword": "SomePasswordAlLeast32LongYouKnowHowToCount",
"twitter": { "twitter": {
"es": { "es": {
"enabled": true,
"comment": "using later.js", "comment": "using later.js",
"when": "at 9:15 am also at 3:15 pm also at 10:00 pm", "when": "at 9:15 am also at 3:15 pm also at 10:00 pm",
"consumer_key": "...", "consumer_key": "...",
@ -41,6 +42,7 @@
"access_token_secret": "..." "access_token_secret": "..."
}, },
"en": { "en": {
"enabled": true,
"comment": "using later.js", "comment": "using later.js",
"when": "at 9:15 am also at 3:15 pm also at 10:00 pm", "when": "at 9:15 am also at 3:15 pm also at 10:00 pm",
"consumer_key": "...", "consumer_key": "...",