update peer model

This commit is contained in:
mr
2026-01-29 13:12:15 +01:00
parent 97cf629e27
commit c1519f6b26
3 changed files with 11 additions and 7 deletions

View File

@@ -40,7 +40,7 @@ func CheckPeerStatus(peerID string, appName string) (*Peer, bool) {
if code != 200 { // no peer no party
return nil, false
}
url := urlFormat(res.(*Peer).Url, tools.PEER) + "/status" // Format the URL
url := urlFormat(res.(*Peer).APIUrl, tools.PEER) + "/status" // Format the URL
state, services := api.CheckRemotePeer(url)
res.(*Peer).ServicesState = services // Update the services states of the peer
access.UpdateOne(res, peerID) // Update the peer in the db
@@ -65,7 +65,7 @@ func (p *PeerCache) LaunchPeerExecution(peerID string, dataID string,
// If the peer is not reachable, add the execution to the failed executions list
pexec := &PeerExecution{
Method: method.String(),
Url: urlFormat((mypeer.Url), dt) + path, // the url is constitued of : host URL + resource path + action path (ex : mypeer.com/datacenter/resourcetype/path/to/action)
Url: urlFormat((mypeer.APIUrl), dt) + path, // the url is constitued of : host URL + resource path + action path (ex : mypeer.com/datacenter/resourcetype/path/to/action)
Body: body,
DataType: dt.EnumIndex(),
DataID: dataID,
@@ -78,7 +78,7 @@ func (p *PeerCache) LaunchPeerExecution(peerID string, dataID string,
return map[string]interface{}{}, errors.New("peer " + peerID + " not found")
}
// If the peer is reachable, launch the execution
url = urlFormat((mypeer.Url), dt) + path // Format the URL
url = urlFormat((mypeer.APIUrl), dt) + path // Format the URL
tmp := mypeer.FailedExecution // Get the failed executions list
mypeer.FailedExecution = []PeerExecution{} // Reset the failed executions list
NewShallowAccessor().UpdateOne(mypeer, peerID) // Update the peer in the db