Do not subscribe to activation event if already activated

This commit is contained in:
Girish Ramakrishnan
2015-10-28 17:07:13 -07:00
parent 6eb197d1a4
commit 7e37dd4810
2 changed files with 3 additions and 4 deletions
+2 -2
View File
@@ -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) {
+1 -2
View File
@@ -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();
}
}