Skip to content

Commit

Permalink
feat: add endpoint for health check
Browse files Browse the repository at this point in the history
  • Loading branch information
Jennievon committed Dec 22, 2023
1 parent 92d7197 commit 9896ed7
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 8 deletions.
3 changes: 0 additions & 3 deletions go/obsclient/obsclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package obsclient

import (
"errors"
"fmt"
"math/big"
"strings"

Expand Down Expand Up @@ -91,8 +90,6 @@ func (oc *ObsClient) BatchHeaderByHash(hash gethcommon.Hash) (*common.BatchHeade
func (oc *ObsClient) HealthStatusOfNode() (bool, error) {
var healthy *hostcommon.HealthCheck
err := oc.rpcClient.Call(&healthy, rpc.Health)
// log to test
fmt.Println("HealthStatusOfNode", healthy, err)
if err != nil {
return false, err
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,8 @@ func routeItems(r *gin.Engine, server *WebServer) {

func (w *WebServer) getHealthStatus(c *gin.Context) {
healthStatus, err := w.backend.GetHealthStatus()
if err != nil {
errorHandler(c, fmt.Errorf("unable to execute request %w", err), w.logger)
return
}

c.JSON(http.StatusOK, healthStatus)
c.JSON(http.StatusOK, gin.H{"result": healthStatus, "errors": fmt.Sprintf("%s", err)})
}

func (w *WebServer) getLatestBatch(c *gin.Context) {
Expand Down

0 comments on commit 9896ed7

Please sign in to comment.