diff --git a/tools/api.go b/tools/api.go index 08cb9ef..c4d17f7 100644 --- a/tools/api.go +++ b/tools/api.go @@ -136,6 +136,7 @@ func (a *API) CheckRemotePeer(url string) (State, map[string]int) { // CheckRemoteAPIs checks the state of remote APIs from your proper OC func (a *API) CheckRemoteAPIs(apis []DataType) (State, map[string]string, error) { // Check if the database is up + l := oclib.GetLogger() new := map[string]string{} caller := NewHTTPCaller(map[DataType]map[METHOD]string{}) // Create a new http caller code := 0 @@ -146,7 +147,6 @@ func (a *API) CheckRemoteAPIs(apis []DataType) (State, map[string]string, error) var resp APIStatusResponse b, err := caller.CallGet("http://"+api.API()+":8080", "/oc/version/status") // Call the status endpoint of the remote API (standard OC status endpoint) if err != nil { - l := oclib.GetLogger() l.Error().Msg(api.String() + " not reachable") state = REDUCED_SERVICE // If a remote API is not reachable, return reduced service continue @@ -164,6 +164,7 @@ func (a *API) CheckRemoteAPIs(apis []DataType) (State, map[string]string, error) reachable = true // If the remote API is reachable, set reachable to true cause we are not dead } if !reachable { + l.Error().Msg("Peer check returned no answers") state = DEAD // If no remote API is reachable, return dead, nobody is alive } if code > 0 {