mirror of
https://github.com/embarklabs/embark.git
synced 2025-01-11 22:34:24 +00:00
Fixed issue with IPFS not starting when swarm failed.
Added logging when starting of all storage providers has completed, and whether or not there were errors during starting of one of the providers. Added parallel processing for starting dappConnection storage providers. Removed irrelevant IPFS error from trace logs when IPFS not available.
This commit is contained in:
parent
fd1b9d80f9
commit
24e1ed36f7
@ -57,7 +57,7 @@ class IPFS {
|
|||||||
}
|
}
|
||||||
function versionCb(err, body) {
|
function versionCb(err, body) {
|
||||||
if (err) {
|
if (err) {
|
||||||
self.logger.trace("Check IPFS version error: " + err);
|
self.logger.trace("IPFS unavailable");
|
||||||
return cb({name: "IPFS ", status: 'off'});
|
return cb({name: "IPFS ", status: 'off'});
|
||||||
}
|
}
|
||||||
if (body.Version) {
|
if (body.Version) {
|
||||||
|
@ -156,24 +156,22 @@ class Storage {
|
|||||||
|
|
||||||
checkStorageService(platform, url, callback) {
|
checkStorageService(platform, url, callback) {
|
||||||
const self = this;
|
const self = this;
|
||||||
const errorObj = {message: __('Cannot upload: {{platform}} node is not running on {{url}}.', {platform: platform, url: url})};
|
|
||||||
|
|
||||||
// start the upload storage node
|
// start the upload storage node
|
||||||
self._checkStorageEndpoint(platform, function (err) {
|
self._checkStorageEndpoint(platform, function (err) {
|
||||||
if (!err) {
|
if (!err) {
|
||||||
return callback();
|
return callback(null);
|
||||||
}
|
}
|
||||||
self._startStorageNode(platform, (err) => {
|
self._startStorageNode(platform, (err) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
self._logger.error(err);
|
return callback(err);
|
||||||
return callback(errorObj);
|
|
||||||
}
|
}
|
||||||
// Check endpoint again to see if really did start
|
// Check endpoint again to see if really did start
|
||||||
self._checkStorageEndpoint(platform, (err) => {
|
self._checkStorageEndpoint(platform, (err) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
return callback(errorObj);
|
return callback(err);
|
||||||
}
|
}
|
||||||
callback();
|
callback(null);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -182,20 +180,44 @@ class Storage {
|
|||||||
startStorageProcesses(){
|
startStorageProcesses(){
|
||||||
let platform = this._storageConfig.upload.provider;
|
let platform = this._storageConfig.upload.provider;
|
||||||
let self = this;
|
let self = this;
|
||||||
|
let withErrors = false;
|
||||||
|
|
||||||
async.waterfall([
|
async.waterfall([
|
||||||
function _checkStorageService(callback){
|
function _checkStorageService(callback){
|
||||||
self.checkStorageService(platform, utils.buildUrlFromConfig(self._storageConfig.upload), callback);
|
self.checkStorageService(platform, utils.buildUrlFromConfig(self._storageConfig.upload), (err) => {
|
||||||
|
// log error and continue
|
||||||
|
if(err){
|
||||||
|
self._logger.error(err);
|
||||||
|
withErrors = true;
|
||||||
|
}
|
||||||
|
callback(null);
|
||||||
|
});
|
||||||
},
|
},
|
||||||
function checkDappConnectionStorageService(callback){
|
function checkDappConnectionStorageService(callback){
|
||||||
// start any dappConnection storage nodes
|
// start any dappConnection storage nodes
|
||||||
self._validDappProviders.forEach(dappConn => {
|
async.each(self._validDappProviders, function(dappConn, cb) {
|
||||||
if(!dappConn.provider || dappConn.provider === platform) return; // don't start the process we've just started above
|
if(!dappConn.provider || dappConn.provider === platform) {
|
||||||
|
return cb(null);
|
||||||
|
} // don't start the process we've just started above
|
||||||
|
|
||||||
self.checkStorageService(dappConn.provider, utils.buildUrlFromConfig(dappConn), callback);
|
self.checkStorageService(dappConn.provider, utils.buildUrlFromConfig(dappConn), (err) => {
|
||||||
});
|
// log error and continue
|
||||||
|
if(err){
|
||||||
|
self._logger.error(err);
|
||||||
|
withErrors = true;
|
||||||
|
}
|
||||||
|
cb(null);
|
||||||
|
});
|
||||||
|
}, callback);
|
||||||
}
|
}
|
||||||
]);
|
], function (){
|
||||||
|
let strComplete = __('Finished starting all storage providers');
|
||||||
|
if(withErrors){
|
||||||
|
strComplete += ', ' + __('with errors.');
|
||||||
|
return self._logger.warn(strComplete);
|
||||||
|
}
|
||||||
|
self._logger.info(strComplete + '.');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user