missing datacenter resource

This commit is contained in:
mr 2024-10-07 14:39:02 +02:00
parent e69d5b3351
commit 03e066c297

View File

@ -40,6 +40,8 @@ func (p *PeerCache) urlFormat(url string, dt tools.DataType) string {
}
url = strings.ReplaceAll(url, "localhost", dt.API()+":8080")
url = strings.ReplaceAll(url, "127.0.0.1", dt.API()+":8080")
} else {
url = url + "/" + dt.API()
}
return url
}
@ -84,7 +86,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: p.urlFormat((mypeer.Url)+"/"+dt.API()+meth, dt),
Url: p.urlFormat((mypeer.Url)+meth, dt),
Body: body,
DataType: dt.EnumIndex(),
DataID: dataID,
@ -94,7 +96,7 @@ func (p *PeerCache) LaunchPeerExecution(peerID string, dataID string,
return nil, errors.New("peer is not reachable")
} else {
// If the peer is reachable, launch the execution
url = p.urlFormat((mypeer.Url)+"/"+dt.API()+meth, dt) // Format the URL
url = p.urlFormat((mypeer.Url)+meth, dt) // Format the URL
tmp := mypeer.FailedExecution // Get the failed executions list
mypeer.FailedExecution = []PeerExecution{} // Reset the failed executions list
mypeer.GetAccessor(nil).UpdateOne(mypeer, peerID) // Update the peer in the db