From e35474f726c40f00773a6b4c15d43a1eb6788f1b Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Wed, 30 May 2018 13:23:18 -0400 Subject: [PATCH] early return --- lib/index.js | 39 ++++++++++--------- .../storageProcessesLauncher.js | 2 +- 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/lib/index.js b/lib/index.js index 3fa030961..828026158 100644 --- a/lib/index.js +++ b/lib/index.js @@ -175,14 +175,15 @@ class Embark { // Check storage const platform = engine.config.storageConfig.provider; self._checkStorageEndpoint(engine, platform, (err) => { - if (err) { - return self._startStorageNode(engine, platform, (err) => { - if (err) { - engine.logger.error('Error while starting a storage process for ' + platform); - engine.logger.error(err); - } - }); + if (!err) { + return; } + 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 () { @@ -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})}; self._checkStorageEndpoint(engine, platform, function (err) { - if (err) { - return self._startStorageNode(engine, platform, (err) => { + if (!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) { - engine.logger.error(err); return callback(errorObj); } - // Check endpoint again to see if really did start - self._checkStorageEndpoint(engine, platform, (err) => { - if (err) { - return callback(errorObj); - } - callback(); - }); + callback(); }); - } - callback(); + }); }); }, function setupStoragePlugin(callback){ diff --git a/lib/processes/storageProcesses/storageProcessesLauncher.js b/lib/processes/storageProcesses/storageProcessesLauncher.js index e66678726..49a1ddf41 100644 --- a/lib/processes/storageProcesses/storageProcessesLauncher.js +++ b/lib/processes/storageProcesses/storageProcessesLauncher.js @@ -37,7 +37,7 @@ class StorageProcessesLauncher { modulePath: filePath, logger: self.logger, events: self.events, - silent: false, + silent: true, exitCallback: self.processExited.bind(this, storageName) }); self.processes[storageName].send({