Skip to content

Commit

Permalink
No longer check if archiver is ahead of network in healthcheck.
Browse files Browse the repository at this point in the history
  • Loading branch information
LINCKODE authored and 0xluk committed May 20, 2024
1 parent 64317b9 commit 53c6459
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions rpc/rpc_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
"google.golang.org/protobuf/types/known/emptypb"
"io"
"log"
"math"
"net"
"net/http"
)
Expand Down Expand Up @@ -321,21 +320,15 @@ func (s *Server) GetHealthCheck(ctx context.Context, _ *emptypb.Empty) (*protobu
//Poll node-fetcher for network tick
chainTick, err := fetchChainTick(ctx, s.chainTickFetchUrl)
if err != nil {
return nil, status.Errorf(codes.Internal, "fetching chain tick: %v", err)
return nil, status.Errorf(codes.Internal, "fetching network tick: %v", err)
}

//Calculate difference between node tick and our last processed tick. difference = nodeTick - lastProcessed
difference := chainTick - int(lastProcessedTick.TickNumber)

//If we're ahead of the node something is clearly wrong here
//TODO: Should we use the threshold here?
if difference < 0 {
return nil, status.Errorf(codes.Internal, "processor is ahead of node by %d ticks", int(math.Abs(float64(difference))))
}

//If the sync difference is bigger than our threshold
if difference > s.syncThreshold {
return nil, status.Errorf(codes.Internal, "processor is behind node by %d ticks", difference)
return nil, status.Errorf(codes.Internal, "processor is behind network by %d ticks", difference)
}

return &protobuff.GetHealthCheckResponse{Status: true}, nil
Expand Down

0 comments on commit 53c6459

Please sign in to comment.