From 4150a65220e462c86209ce171d32828597308f2c Mon Sep 17 00:00:00 2001 From: Martin Donnelly Date: Tue, 16 Feb 2016 16:36:49 +0000 Subject: [PATCH] added hourly cron job to update train and weather --- lib/today.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/lib/today.js b/lib/today.js index 452d735..5f33568 100644 --- a/lib/today.js +++ b/lib/today.js @@ -276,6 +276,25 @@ module.exports = { }); }, + refreshTrainAndWeather:function() { + + try { + module.exports.doGetWeatherOutlook(); + } + catch (e) { + // statements to handle any exceptions + logger.error(e); + } + + try { + module.exports.updateTrains(); + } + catch (e) { + // statements to handle any exceptions + logger.error(e); + } + + }, preLoadToday: function () { module.exports.getTodayDate(); var self = this; @@ -387,6 +406,11 @@ cron.schedule('45 6 * * *', function () { return -1; }); +cron.schedule('0 */1 * * *', function () { + module.exports.refreshTrainAndWeather(); + return -1; +}); + cron.schedule('0 7 * * *', function () { sendEmailV1(); // console.log('tick');