simplify call to peer

This commit is contained in:
mr 2024-08-23 09:57:11 +02:00
parent 9f72f4b2f8
commit 152bdd8061

View File

@ -93,6 +93,7 @@ func (p *PeerCache) LaunchPeerExecution(peerID string, dataID string,
}
if mypeer, ok := p.checkPeerStatus(peerID, caller); !ok {
mypeer.AddExecution(*pexec)
mypeer.GetAccessor(nil).UpdateOne(mypeer, peerID)
return nil, errors.New("peer is not reachable")
} else {
url = p.urlFormat((mypeer.Url)+meth, dt)
@ -102,6 +103,7 @@ func (p *PeerCache) LaunchPeerExecution(peerID string, dataID string,
tmp = append(tmp, v)
}
mypeer.FailedExecution = []PeerExecution{}
mypeer.GetAccessor(nil).UpdateOne(mypeer, peerID)
for _, v := range tmp {
go p.LaunchPeerExecution(peerID, v.DataID, utils.DataType(v.DataType), tools.ToMethod(v.Method), v.Body, caller)
}