removed caller from checkPeerStatus() parameters by adding the path to url

This commit is contained in:
pb 2025-03-05 11:54:14 +01:00
parent d4f000466f
commit 18c723ee42

View File

@ -48,7 +48,7 @@ func (p *PeerCache) urlFormat(hostUrl string, dt tools.DataType) string {
hostUrl = strings.ReplaceAll(hostUrl, localhost, dt.API()+":8080/oc") hostUrl = strings.ReplaceAll(hostUrl, localhost, dt.API()+":8080/oc")
} }
} else { } else {
hostUrl = dt.API() + "/" + hostUrl hostUrl = hostUrl + "/" + strings.ReplaceAll(dt.API(), "oc-", "")
} }
fmt.Println("Host URL : ", hostUrl) fmt.Println("Host URL : ", hostUrl)
return hostUrl return hostUrl
@ -66,9 +66,6 @@ func (p *PeerCache) checkPeerStatus(peerID string, appName string) (*Peer, bool)
state, services := api.CheckRemotePeer(url) state, services := api.CheckRemotePeer(url)
res.(*Peer).ServicesState = services // Update the services states of the peer res.(*Peer).ServicesState = services // Update the services states of the peer
access.UpdateOne(res, peerID) // Update the peer in the db access.UpdateOne(res, peerID) // Update the peer in the db
fmt.Println("URL peer : ", url)
fmt.Println("State : ", state)
fmt.Println("Services : ", services)
return res.(*Peer), state != tools.DEAD && services[appName] == 0 // Return the peer and its status return res.(*Peer), state != tools.DEAD && services[appName] == 0 // Return the peer and its status
} }