try to fix installation error

This commit is contained in:
marvzhang
2020-03-08 15:30:12 +08:00
parent 96a8ad51b2
commit b422be8c3d
2 changed files with 20 additions and 6 deletions

View File

@@ -192,21 +192,27 @@ func RpcClientFunc(nodeId string, method string, params map[string]string, timeo
// 发送RPC消息
msgStr := ObjectToString(msg)
if err := database.RedisClient.LPush(fmt.Sprintf("rpc:%s", nodeId), msgStr); err != nil {
log.Errorf("RpcClientFunc error: " + err.Error())
debug.PrintStack()
return result, err
}
// 获取RPC回复消息
dataStr, err := database.RedisClient.BRPop(fmt.Sprintf("rpc:%s", nodeId), timeout)
if err != nil {
log.Errorf("RpcClientFunc error: " + err.Error())
debug.PrintStack()
return result, err
}
// 反序列化消息
if err := json.Unmarshal([]byte(dataStr), &msg); err != nil {
log.Errorf("RpcClientFunc error: " + err.Error())
debug.PrintStack()
return result, err
}
return msg.Result, err
return msg.Result, nil
}
}

View File

@@ -40,7 +40,7 @@
<template slot="header" slot-scope="scope">
<div class="header-with-action">
<span>{{scope.column.label}}</span>
<el-button type="primary" size="mini" @click="onInstallAll(scope.column.name)">
<el-button type="primary" size="mini" @click="onInstallAll(scope.column.label)">
{{$t('Install')}}
</el-button>
</div>
@@ -113,13 +113,21 @@ export default {
},
methods: {
async getData () {
await Promise.all(this.nodeList.map(async n => {
// await Promise.all(this.nodeList.map(async n => {
// const res = await this.$request.get(`/nodes/${n._id}/langs`)
// res.data.data.forEach(l => {
// const key = n._id + '|' + l.executable_name
// this.$set(this.dataDict, key, l)
// })
// }))
for (let i = 0; i < this.nodeList.length; i++) {
const n = this.nodeList[i]
const res = await this.$request.get(`/nodes/${n._id}/langs`)
res.data.data.forEach(l => {
const key = n._id + '|' + l.executable_name
this.$set(this.dataDict, key, l)
})
}))
}
},
getLang (nodeId, langName) {
const key = nodeId + '|' + langName
@@ -149,11 +157,11 @@ export default {
this.getData()
}, 1000)
},
async onInstallAll (langName) {
async onInstallAll (langLabel) {
this.nodeList
.filter(n => n.status === 'online')
.forEach(n => {
this.onInstall(n._id, langName)
this.onInstall(n._id, langLabel)
})
setTimeout(() => {
this.getData()