hard stuff

This commit is contained in:
mr 2024-11-19 10:08:46 +01:00
parent 902ad0ea71
commit 3b8079ca87

View File

@ -91,7 +91,7 @@ func (p *PeerCache) LaunchPeerExecution(peerID string, dataID string,
url := ""
// Check the status of the peer
if mypeer, ok := p.checkPeerStatus(peerID, dt.API(), caller); !ok {
if mypeer, ok := p.checkPeerStatus(peerID, dt.API(), caller); !ok && mypeer != nil {
// If the peer is not reachable, add the execution to the failed executions list
pexec := &PeerExecution{
Method: method.String(),
@ -104,6 +104,9 @@ func (p *PeerCache) LaunchPeerExecution(peerID string, dataID string,
mypeer.GetAccessor(nil).UpdateOne(mypeer, peerID) // Update the peer in the db
return nil, errors.New("peer is not reachable")
} else {
if mypeer == nil {
return nil, errors.New("peer not found")
}
// If the peer is reachable, launch the execution
url = p.urlFormat((mypeer.Url)+meth, dt) // Format the URL
tmp := mypeer.FailedExecution // Get the failed executions list