No discovery needed

This commit is contained in:
mr 2024-08-23 09:03:51 +02:00
parent e4ee33dcbe
commit 2404ee3fce

View File

@ -80,11 +80,11 @@ func (a *API) CheckRemotePeer(url string) (State, map[string]int) {
return ToState(resp.Data.State), new
}
func (a *API) CheckRemoteAPIs(urls []string) (State, map[string]int, error) {
func (a *API) CheckRemoteAPIs(urls map[string]string) (State, map[string]int, error) {
// Check if the database is up
new := map[string]int{}
caller := NewHTTPCaller(map[string]map[METHOD]string{})
for _, url := range urls {
for appName, url := range urls {
var resp APIStatusResponse
b, err := caller.CallGet(url, "/version/status")
if err != nil {
@ -94,9 +94,7 @@ func (a *API) CheckRemoteAPIs(urls []string) (State, map[string]int, error) {
if resp.Data == nil {
return DEAD, new, errors.New(url + " -> is DEAD")
}
for k, v := range resp.Data.Services {
new[k] = ToState(v).EnumIndex()
}
new[appName] = ToState(resp.Data.State).EnumIndex()
if resp.Data.Code != 0 {
return REDUCED_SERVICE, new, errors.New(url + " -> " + resp.Error)
}