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

This commit is contained in:
pb
2025-03-03 10:32:52 +01:00
parent 3acebc451e
commit 95af3cb515
2 changed files with 6 additions and 15 deletions

View File

@@ -3,7 +3,6 @@ package tools
import (
"encoding/json"
"errors"
"fmt"
"strings"
"cloud.o-forge.io/core/oc-lib/config"
@@ -98,7 +97,6 @@ func (a *API) SubscribeRouter(infos []*beego.ControllerInfo) {
nats := NewNATSCaller()
discovery := map[string][]string{}
for _, info := range infos {
fmt.Println("DISCOVERY", info.GetPattern())
path := strings.ReplaceAll(info.GetPattern(), "/oc/", "/"+strings.ReplaceAll(config.GetAppName(), "oc-", ""))
for k, v := range info.GetMethod() {
if discovery[path] == nil {
@@ -117,8 +115,8 @@ func (a *API) SubscribeRouter(infos []*beego.ControllerInfo) {
// CheckRemotePeer checks the state of a remote peer
func (a *API) CheckRemotePeer(url string) (State, map[string]int) {
// Check if the database is up
caller := NewHTTPCaller(map[DataType]map[METHOD]string{}) // Create a new http caller
var resp APIStatusResponse
caller := NewHTTPCaller(map[DataType]map[METHOD]string{}) // Create a new http caller
b, err := caller.CallPost(url, "", map[string]interface{}{}) // Call the status endpoint of the peer
if err != nil {
return DEAD, map[string]int{} // If the peer is not reachable, return dead