From 3ac3207497df6a740b4172fc0e0c006487b41784 Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Tue, 27 Oct 2015 16:05:19 -0700 Subject: [PATCH] send heartbeats regardless of activation --- src/cron.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/cron.js b/src/cron.js index 01631b106..5dd4a72c4 100644 --- a/src/cron.js +++ b/src/cron.js @@ -47,6 +47,13 @@ function initialize(callback) { cloudron.events.on(cloudron.EVENT_ACTIVATED, recreateJobs); + // send heartbeats regardless of activation + gHeartbeatJob = new CronJob({ + cronTime: '00 */1 * * * *', // every minute + onTick: cloudron.sendHeartbeat, + start: true + }); + gInitialized = true; callback(); @@ -58,14 +65,6 @@ function recreateJobs(unusedTimeZone, callback) { settings.getAll(function (error, allSettings) { debug('Creating jobs with timezone %s', allSettings[settings.TIME_ZONE_KEY]); - if (gHeartbeatJob) gHeartbeatJob.stop(); - gHeartbeatJob = new CronJob({ - cronTime: '00 */1 * * * *', // every minute - onTick: cloudron.sendHeartbeat, - start: true, - timeZone: allSettings[settings.TIME_ZONE_KEY] - }); - if (gBackupJob) gBackupJob.stop(); gBackupJob = new CronJob({ cronTime: '00 00 */4 * * *', // every 4 hours