This commit is contained in:
mr 2024-08-23 09:11:41 +02:00
parent a2f1bef34a
commit 29c2ab0e4c

View File

@ -55,17 +55,19 @@ func (p *PeerCache) checkPeerStatus(peerID string, caller *tools.HTTPCaller) boo
return false
}
methods := caller.URLS[utils.PEER.String()]
fmt.Println("PEER AFT 3", methods)
if methods == nil {
return false
}
meth := methods[tools.POST]
fmt.Println("PEER AFT 4", meth)
if meth == "" {
return false
}
url := p.urlFormat(res.(*Peer).Url+meth, utils.PEER)
state := api.CheckRemotePeer(url)
res.(*Peer).State = state
fmt.Println("PEER AFT 5", url)
state, services := api.CheckRemotePeer(url)
res.(*Peer).Services = services
access.UpdateOne(res, peerID)
fmt.Printf("Peer %v is %v\n", peerID, state)
return state != tools.DEAD
@ -92,6 +94,7 @@ func (p *PeerCache) LaunchPeerExecution(peerID string, isMySelf bool, dataID str
meth = strings.ReplaceAll(meth, ":id", dataID)
}
url = p.urlFormat(url+meth, dt)
fmt.Println("LaunchPeerExecution AFT 3", url)
if !p.checkPeerStatus(peerID, caller) {
return nil, errors.New("peer is not reachable")
}
@ -118,10 +121,10 @@ func (p *PeerCache) LaunchPeerExecution(peerID string, isMySelf bool, dataID str
DataID: dataID,
}
singleton.Executions = append(singleton.Executions, pexec)
if currentRountine == 0 {
/*if currentRountine == 0 {
currentRountine++
go p.retryPeerExecution()
}
}*/
return pexec, err
}
fmt.Println("LaunchPeerExecution AFT 3", m, url)