simplify call to peer
This commit is contained in:
parent
9f72f4b2f8
commit
152bdd8061
@ -93,6 +93,7 @@ func (p *PeerCache) LaunchPeerExecution(peerID string, dataID string,
|
|||||||
}
|
}
|
||||||
if mypeer, ok := p.checkPeerStatus(peerID, caller); !ok {
|
if mypeer, ok := p.checkPeerStatus(peerID, caller); !ok {
|
||||||
mypeer.AddExecution(*pexec)
|
mypeer.AddExecution(*pexec)
|
||||||
|
mypeer.GetAccessor(nil).UpdateOne(mypeer, peerID)
|
||||||
return nil, errors.New("peer is not reachable")
|
return nil, errors.New("peer is not reachable")
|
||||||
} else {
|
} else {
|
||||||
url = p.urlFormat((mypeer.Url)+meth, dt)
|
url = p.urlFormat((mypeer.Url)+meth, dt)
|
||||||
@ -102,6 +103,7 @@ func (p *PeerCache) LaunchPeerExecution(peerID string, dataID string,
|
|||||||
tmp = append(tmp, v)
|
tmp = append(tmp, v)
|
||||||
}
|
}
|
||||||
mypeer.FailedExecution = []PeerExecution{}
|
mypeer.FailedExecution = []PeerExecution{}
|
||||||
|
mypeer.GetAccessor(nil).UpdateOne(mypeer, peerID)
|
||||||
for _, v := range tmp {
|
for _, v := range tmp {
|
||||||
go p.LaunchPeerExecution(peerID, v.DataID, utils.DataType(v.DataType), tools.ToMethod(v.Method), v.Body, caller)
|
go p.LaunchPeerExecution(peerID, v.DataID, utils.DataType(v.DataType), tools.ToMethod(v.Method), v.Body, caller)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user