1
0
Fork 0
mirror of https://github.com/eosswedenorg/antelope-api-healthcheck synced 2026-06-20 09:56:49 +02:00

Merge branch 'master' into devel

This commit is contained in:
Henrik Hautakoski 2020-11-04 13:59:58 +01:00
commit 324356f9f4
4 changed files with 21 additions and 1 deletions

View file

@ -22,6 +22,12 @@ func check_api(p eosapi.ReqParams, block_time float64) (haproxy.HealthCheckStatu
return haproxy.HealthCheckFailed, msg
}
// Check HTTP Status Code
if info.HTTPStatusCode > 299 {
return haproxy.HealthCheckDown,
fmt.Sprintf("Taking offline because %v was received from backend", info.HTTPStatusCode)
}
// Validate head block.
now := time.Now().In(time.UTC)
diff := now.Sub(info.HeadBlockTime).Seconds()
@ -48,6 +54,12 @@ func check_api_v2(p eosapi.ReqParams, offset int64) (haproxy.HealthCheckStatus,
return haproxy.HealthCheckFailed, msg
}
// Check HTTP Status Code
if health.HTTPStatusCode > 299 {
return haproxy.HealthCheckDown,
fmt.Sprintf("Taking offline because %v was received from backend", health.HTTPStatusCode)
}
// Fetch elasticsearch and nodeos block numbers from json.
var es_block int64 = 0
var node_block int64 = 0