url format improved

This commit is contained in:
mr 2024-10-07 16:01:11 +02:00
parent 3bbde50f96
commit 3c14c64f4a

View File

@ -44,6 +44,8 @@ func (p *PeerCache) urlFormat(url string, dt tools.DataType) string {
t := r.FindString(url)
if t != "" {
url = strings.Replace(url, t, dt.API()+":8080", -1)
} else {
strings.ReplaceAll(url, localhost, dt.API()+":8080")
}
} else {
url = url + "/" + dt.API()
@ -86,6 +88,7 @@ func (p *PeerCache) LaunchPeerExecution(peerID string, dataID string,
meth := methods[method] // Get the method url to execute
meth = strings.ReplaceAll(meth, ":id", dataID) // Replace the id in the url in case of a DELETE / UPDATE method (it's a standard naming in OC)
url := ""
// Check the status of the peer
if mypeer, ok := p.checkPeerStatus(peerID, dt.API(), caller); !ok {
// If the peer is not reachable, add the execution to the failed executions list