simplify call to peer

This commit is contained in:
mr 2024-08-23 11:13:01 +02:00
parent 98fa1f6ca8
commit 5b3779e4cb

View File

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