added another error log when the status is dead
This commit is contained in:
parent
7b8aa989f6
commit
03dea55131
@ -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
|
// CheckRemoteAPIs checks the state of remote APIs from your proper OC
|
||||||
func (a *API) CheckRemoteAPIs(apis []DataType) (State, map[string]string, error) {
|
func (a *API) CheckRemoteAPIs(apis []DataType) (State, map[string]string, error) {
|
||||||
// Check if the database is up
|
// Check if the database is up
|
||||||
|
l := oclib.GetLogger()
|
||||||
new := map[string]string{}
|
new := map[string]string{}
|
||||||
caller := NewHTTPCaller(map[DataType]map[METHOD]string{}) // Create a new http caller
|
caller := NewHTTPCaller(map[DataType]map[METHOD]string{}) // Create a new http caller
|
||||||
code := 0
|
code := 0
|
||||||
@ -146,7 +147,6 @@ func (a *API) CheckRemoteAPIs(apis []DataType) (State, map[string]string, error)
|
|||||||
var resp APIStatusResponse
|
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)
|
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 {
|
if err != nil {
|
||||||
l := oclib.GetLogger()
|
|
||||||
l.Error().Msg(api.String() + " not reachable")
|
l.Error().Msg(api.String() + " not reachable")
|
||||||
state = REDUCED_SERVICE // If a remote API is not reachable, return reduced service
|
state = REDUCED_SERVICE // If a remote API is not reachable, return reduced service
|
||||||
continue
|
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
|
reachable = true // If the remote API is reachable, set reachable to true cause we are not dead
|
||||||
}
|
}
|
||||||
if !reachable {
|
if !reachable {
|
||||||
|
l.Error().Msg("Peer check returned no answers")
|
||||||
state = DEAD // If no remote API is reachable, return dead, nobody is alive
|
state = DEAD // If no remote API is reachable, return dead, nobody is alive
|
||||||
}
|
}
|
||||||
if code > 0 {
|
if code > 0 {
|
||||||
|
Loading…
Reference in New Issue
Block a user