emit platform ready timer only if platform succeeded

This commit is contained in:
Girish Ramakrishnan
2016-07-24 22:59:47 -07:00
parent 0c014d3e74
commit b45fc46ff3

View File

@@ -59,16 +59,20 @@ function initialize(callback) {
loadAddonVars,
mailboxes.setupAliases,
fs.writeFile.bind(fs, paths.INFRA_VERSION_FILE, JSON.stringify(infra))
], callback);
], function (error) {
if (error) return callback(error);
// give 30 seconds for the platform to "settle". For example, mysql might still be initing the
// database dir and we cannot call service scripts until that's done.
// TODO: make this smarter to not wait for 30secs for the crash-restart case
gPlatformReadyTimer = setTimeout(function () {
debug('emitting platform ready');
gPlatformReadyTimer = null;
exports.events.emit(exports.EVENT_READY);
}, 30000);
// give 30 seconds for the platform to "settle". For example, mysql might still be initing the
// database dir and we cannot call service scripts until that's done.
// TODO: make this smarter to not wait for 30secs for the crash-restart case
gPlatformReadyTimer = setTimeout(function () {
debug('emitting platform ready');
gPlatformReadyTimer = null;
exports.events.emit(exports.EVENT_READY);
}, 30000);
callback();
});
}
function uninitialize(callback) {