diff --git a/src/platform.js b/src/platform.js index e2ac4c599..33a63babe 100644 --- a/src/platform.js +++ b/src/platform.js @@ -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) {