simplify call to peer
This commit is contained in:
parent
98fa1f6ca8
commit
5b3779e4cb
@ -80,9 +80,9 @@ func (a *API) CheckRemotePeer(url string) (State, map[string]int) {
|
|||||||
return ToState(resp.Data.State), new
|
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
|
// Check if the database is up
|
||||||
new := map[string]int{}
|
new := map[string]string{}
|
||||||
caller := NewHTTPCaller(map[string]map[METHOD]string{})
|
caller := NewHTTPCaller(map[string]map[METHOD]string{})
|
||||||
for appName, url := range urls {
|
for appName, url := range urls {
|
||||||
var resp APIStatusResponse
|
var resp APIStatusResponse
|
||||||
@ -94,7 +94,7 @@ func (a *API) CheckRemoteAPIs(urls map[string]string) (State, map[string]int, er
|
|||||||
if resp.Data == nil {
|
if resp.Data == nil {
|
||||||
return DEAD, new, errors.New(url + " -> is DEAD")
|
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 {
|
if resp.Data.Code != 0 {
|
||||||
return REDUCED_SERVICE, new, errors.New(url + " -> " + resp.Error)
|
return REDUCED_SERVICE, new, errors.New(url + " -> " + resp.Error)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user