Skip to content

Commit

Permalink
fix err
Browse files Browse the repository at this point in the history
  • Loading branch information
YukiAbyss committed Aug 12, 2024
1 parent 780b2b6 commit 244a47e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions abci/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ func LastBlockHeight(rpc string) (int64, error) {
}
defer utils.CloseBody(resp.Body)
body, err := io.ReadAll(resp.Body)
if err != nil {
return 0, err
}
result := gjson.GetBytes(body, "result.response.last_block_height")
return result.Int(), nil
}
Expand All @@ -30,5 +33,8 @@ func BsDBInfoBlockHeight(spHost string, height int64) (string, error) {
}
defer utils.CloseBody(resp.Body)
body, err := io.ReadAll(resp.Body)
if err != nil {
return "", err
}
return string(body), nil
}
4 changes: 2 additions & 2 deletions checks/dbshard.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ var (
func CheckDbShard(checkEnv, checkRpc string, checkSpHosts []string) {
checkBlockMetrics := promauto.NewGauge(prometheus.GaugeOpts{Name: fmt.Sprintf("%v_sp_db_shard_check_block_height", checkEnv)})
lastChainHeight, err := abci.LastBlockHeight(checkRpc)
calcHeight := lastChainHeight / 3600 * 3600
checkBlockMetrics.Set(float64(calcHeight))
if err != nil {
checkBlockMetrics.Set(float64(GetBlockHeightErr))
return
}
calcHeight := lastChainHeight / 3600 * 3600
checkBlockMetrics.Set(float64(calcHeight))

checkSpErrCodeMetrics := make([]prometheus.Gauge, len(checkSpHosts))
objCountArr := make([][]gjson.Result, len(checkSpHosts))
Expand Down

0 comments on commit 244a47e

Please sign in to comment.