From dbdccdb92058c57cd5f9d2e97deb9e81ec151bf0 Mon Sep 17 00:00:00 2001 From: pb Date: Wed, 5 Mar 2025 11:01:46 +0100 Subject: [PATCH] Corrected urlFormat() from peer_cache which constructed url with API's name at the end --- models/peer/peer_cache.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/models/peer/peer_cache.go b/models/peer/peer_cache.go index 66f5f65..a6cf142 100644 --- a/models/peer/peer_cache.go +++ b/models/peer/peer_cache.go @@ -48,7 +48,7 @@ func (p *PeerCache) urlFormat(url string, dt tools.DataType) string { url = strings.ReplaceAll(url, localhost, dt.API()+":8080/oc") } } else { - url = url + "/" + dt.API() + url = dt.API() + "/" + url } return url } @@ -61,11 +61,13 @@ func (p *PeerCache) checkPeerStatus(peerID string, appName string) (*Peer, bool) if code != 200 { // no peer no party return nil, false } - url := p.urlFormat(res.(*Peer).Url, 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 + 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 }