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