early return

This commit is contained in:
Jonathan Rainville 2018-05-30 13:23:18 -04:00
parent 4db2d40ef5
commit e35474f726
2 changed files with 21 additions and 20 deletions

View File

@ -175,14 +175,15 @@ class Embark {
// Check storage // Check storage
const platform = engine.config.storageConfig.provider; const platform = engine.config.storageConfig.provider;
self._checkStorageEndpoint(engine, platform, (err) => { self._checkStorageEndpoint(engine, platform, (err) => {
if (err) { if (!err) {
return self._startStorageNode(engine, platform, (err) => { return;
if (err) {
engine.logger.error('Error while starting a storage process for ' + platform);
engine.logger.error(err);
}
});
} }
self._startStorageNode(engine, platform, (err) => {
if (err) {
engine.logger.error('Error while starting a storage process for ' + platform);
engine.logger.error(err);
}
});
}); });
engine.events.on('outputDone', function () { engine.events.on('outputDone', function () {
@ -376,22 +377,22 @@ class Embark {
const errorObj = {message: __('Cannot upload: {{platform}} node is not running on {{protocol}}://{{host}}:{{port}}.', {platform: platform, protocol: engine.config.storageConfig.protocol, host: engine.config.storageConfig.host, port: engine.config.storageConfig.port})}; const errorObj = {message: __('Cannot upload: {{platform}} node is not running on {{protocol}}://{{host}}:{{port}}.', {platform: platform, protocol: engine.config.storageConfig.protocol, host: engine.config.storageConfig.host, port: engine.config.storageConfig.port})};
self._checkStorageEndpoint(engine, platform, function (err) { self._checkStorageEndpoint(engine, platform, function (err) {
if (err) { if (!err) {
return self._startStorageNode(engine, platform, (err) => { return callback();
}
self._startStorageNode(engine, platform, (err) => {
if (err) {
engine.logger.error(err);
return callback(errorObj);
}
// Check endpoint again to see if really did start
self._checkStorageEndpoint(engine, platform, (err) => {
if (err) { if (err) {
engine.logger.error(err);
return callback(errorObj); return callback(errorObj);
} }
// Check endpoint again to see if really did start callback();
self._checkStorageEndpoint(engine, platform, (err) => {
if (err) {
return callback(errorObj);
}
callback();
});
}); });
} });
callback();
}); });
}, },
function setupStoragePlugin(callback){ function setupStoragePlugin(callback){

View File

@ -37,7 +37,7 @@ class StorageProcessesLauncher {
modulePath: filePath, modulePath: filePath,
logger: self.logger, logger: self.logger,
events: self.events, events: self.events,
silent: false, silent: true,
exitCallback: self.processExited.bind(this, storageName) exitCallback: self.processExited.bind(this, storageName)
}); });
self.processes[storageName].send({ self.processes[storageName].send({