From 23fe4912ec809b69f8418aec153dd456490f0605 Mon Sep 17 00:00:00 2001 From: Martin Donnelly Date: Mon, 15 Feb 2016 09:46:27 +0000 Subject: [PATCH] updated today to clear out history and refresh everything together. --- lib/today.js | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/lib/today.js b/lib/today.js index cffe416..fff286e 100644 --- a/lib/today.js +++ b/lib/today.js @@ -259,13 +259,14 @@ module.exports = { }, preLoadToday: function () { + module.exports.getTodayDate(); + try { module.exports.doGetWeatherOutlook(); } catch (e) { // statements to handle any exceptions - console.log('ERROR:'); - console.log(e); + logger.error(e); } try { @@ -273,13 +274,16 @@ module.exports = { } catch (e) { // statements to handle any exceptions - console.log('ERROR:'); - console.log(e); + logger.error(e); } - setTimeout(function () { - module.exports.preLoadToday(); - }, todayCache.expire); + try { + module.exports.getHistory(); + } + catch (e) { + // statements to handle any exceptions + logger.error(e); + } } } ; @@ -329,28 +333,16 @@ function sendEmail() { } setTimeout(function () { - // console.log('Pre loading trains...'); module.exports.preLoadToday(); - }, 15000); -setTimeout(function () { - // console.log('Pre loading trains...'); - module.exports.getTodayDate(); - module.exports.getHistory(); - -}, 25000); setTimeout(function () { - // console.log('Pre loading trains...'); - - // saveData(); sendEmailV1(); - }, 45000); cron.schedule('45 6 * * *', function () { - module.exports.getHistory(); + module.exports.preLoadToday(); return -1; });