diff --git a/src/cloudron.js b/src/cloudron.js index abf8619d8..f555289a0 100644 --- a/src/cloudron.js +++ b/src/cloudron.js @@ -64,7 +64,7 @@ var NOOP_CALLBACK = function (error) { if (error) console.error(error); }; var gAddDnsRecordsTimerId = null, gCloudronDetails = null, // cached cloudron details like region,size... - gIsActivated = false; // cached activation state so that return value is synchronous + gIsActivated = null; // cached activation state so that return value is synchronous. null means we are not initialized yet function debugApp(app, args) { assert(!app || typeof app === 'object'); @@ -140,7 +140,7 @@ function uninitialize(callback) { } function isActivatedSync() { - return gIsActivated; + return gIsActivated === true; } function setTimeZone(ip, callback) { diff --git a/src/cron.js b/src/cron.js index 6d5a8d4cb..7913aa7b9 100644 --- a/src/cron.js +++ b/src/cron.js @@ -41,11 +41,10 @@ function initialize(callback) { settings.events.on(settings.TIME_ZONE_KEY, recreateJobs); settings.events.on(settings.AUTOUPDATE_PATTERN_KEY, autoupdatePatternChanged); - cloudron.events.on(cloudron.EVENT_ACTIVATED, recreateJobs); - if (cloudron.isActivatedSync()) { recreateJobs(callback); } else { + cloudron.events.on(cloudron.EVENT_ACTIVATED, recreateJobs); callback(); } }