fix: blockchain status
This commit is contained in:
parent
2819b8a519
commit
9411b2ea69
6 changed files with 25 additions and 8 deletions
|
|
@ -119,8 +119,22 @@ function getBlockchainSyncStatus (cryptoList) {
|
|||
|
||||
return settingsLoader.loadLatest()
|
||||
.then(settings => {
|
||||
const blockchainStatuses = _.reduce((acc, value) =>
|
||||
_.includes(value.cryptoCode, _.keys(installedCryptos) ? ({ ...acc, [value.cryptoCode]: wallet.checkBlockchainStatus(settings, value.cryptoCode) }) : ({ ...acc })),
|
||||
const blockchainStatuses = _.reduce((acc, value) => {
|
||||
const processStatus = common.es(`sudo supervisorctl status ${value.code} | awk '{ print $2 }'`).trim()
|
||||
return wallet.checkBlockchainStatus(settings, value.cryptoCode)
|
||||
.then(res => {
|
||||
console.log('res', res)
|
||||
return _.includes(value.cryptoCode, _.keys(installedCryptos) ? ({ ...acc, [value.cryptoCode]: res }) : ({ ...acc }))
|
||||
})
|
||||
.catch(err => {
|
||||
console.log('err', err)
|
||||
if (processStatus === 'RUNNING') {
|
||||
console.log(`Detected ${value.cryptoCode} installed on this machine, but couldn't establish a connection. Is this plugin configured via admin?`)
|
||||
return { ...acc, [value.cryptoCode]: 'syncing' }
|
||||
}
|
||||
return { ...acc }
|
||||
})
|
||||
},
|
||||
{},
|
||||
cryptoList
|
||||
)
|
||||
|
|
@ -154,7 +168,7 @@ function run () {
|
|||
validate: (a) => {
|
||||
return getBlockchainSyncStatus(cryptos)
|
||||
.then(chains => {
|
||||
const result = _.reduce((acc, value) => ({ ...acc, [value]: _.isNil() ? 1 : acc[value] + 1 }), {}, _.values(chains))
|
||||
const result = _.reduce((acc, value) => ({ ...acc, [value]: _.isNil(acc[value]) ? 1 : acc[value] + 1 }), {}, _.values(chains))
|
||||
return result.syncing > 0 || _.size(a) > 0 && _.size(a) <= 2
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue