Skip to content

Commit

Permalink
fix health check with connectrpc
Browse files Browse the repository at this point in the history
  • Loading branch information
billettc committed Feb 14, 2024
1 parent a5eda34 commit 9d2c559
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 15 deletions.
7 changes: 0 additions & 7 deletions server/cmd/blockmeta/logger.go

This file was deleted.

9 changes: 5 additions & 4 deletions server/cmd/blockmeta/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,25 @@ import (

"github.com/streamingfast/blockmeta-service/server"
"github.com/streamingfast/dauth"
authGrpc "github.com/streamingfast/dauth/grpc"
authNull "github.com/streamingfast/dauth/null"
"github.com/streamingfast/derr"
"github.com/streamingfast/logging"
"go.uber.org/zap"
)

var (
listenAddress = flag.String("grpc-listen-addr", "", "The gRPC server listen address")
sinkServerAddress = flag.String("sink-addr", "", "The sink server address")
listenAddress = flag.String("grpc-listen-addr", ":9000*", "The gRPC server listen address")
sinkServerAddress = flag.String("sink-addr", ":9001", "The sink server address")
authUrl = flag.String("auth-url", "null://", "The URL of the auth server")
corsHostRegexAllowFlag = flag.String("cors-host-regex-allow", "^localhost", "Regex to allow CORS origin requests from, defaults to localhost only")
)

var zlog, tracer = logging.ApplicationLogger("blockmeta", "github.com/streamingfast/blockmeta-service/server/cmd/blockmeta")

func main() {
flag.Parse()
ctx := context.Background()

authGrpc.Register()
authNull.Register()

if *sinkServerAddress == "" {
Expand Down
2 changes: 1 addition & 1 deletion server/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/rs/cors v1.8.3
github.com/streamingfast/dauth v0.0.0-20240213192022-da4946165b42
github.com/streamingfast/derr v0.0.0-20230515163924-8570aaa43fe1
github.com/streamingfast/dgrpc v0.0.0-20240213191930-14e90f32025f
github.com/streamingfast/dgrpc v0.0.0-20240214134727-3290b8959f76
github.com/streamingfast/logging v0.0.0-20221209193439-bff11742bf4c
github.com/streamingfast/shutter v1.5.0
github.com/streamingfast/substreams-sink-kv v0.1.3-0.20240213164553-1d839b800880
Expand Down
4 changes: 2 additions & 2 deletions server/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ github.com/streamingfast/dauth v0.0.0-20240213192022-da4946165b42 h1:rJ0uQ5xuGn9
github.com/streamingfast/dauth v0.0.0-20240213192022-da4946165b42/go.mod h1:cwfI5vaMd+CiwZIL0H0JdP5UDWCZOVFz/ex3L0+o/j4=
github.com/streamingfast/derr v0.0.0-20230515163924-8570aaa43fe1 h1:xJB7rXnOHLesosMjfwWsEL2i/40mFSkzenEb3M0qTyM=
github.com/streamingfast/derr v0.0.0-20230515163924-8570aaa43fe1/go.mod h1:QSm/AfaDsE0k1xBYi0lW580YJ/WDV/FKZI628tkZR0Y=
github.com/streamingfast/dgrpc v0.0.0-20240213191930-14e90f32025f h1:KFXHHIx0lAMLOn/hnyOcMURUyxfQHgyVA3CbJoQgfi8=
github.com/streamingfast/dgrpc v0.0.0-20240213191930-14e90f32025f/go.mod h1:NuKCwOHjbT0nRji0O+7+c70AiBfLHEKNoovs/gFfMPY=
github.com/streamingfast/dgrpc v0.0.0-20240214134727-3290b8959f76 h1:g12+wDmubRwQD9R7MqjVE1Xaj61pJqz7qOGovoAy6GU=
github.com/streamingfast/dgrpc v0.0.0-20240214134727-3290b8959f76/go.mod h1:NuKCwOHjbT0nRji0O+7+c70AiBfLHEKNoovs/gFfMPY=
github.com/streamingfast/dtracing v0.0.0-20210811175635-d55665d3622a h1:/7Rw3pYpueJYOQReTJpfAhAPk0uZD4I58LfiUAr4IMc=
github.com/streamingfast/dtracing v0.0.0-20210811175635-d55665d3622a/go.mod h1:bqiYZaX6L/MoXNfFQeAdau6g9HLA3yKHkX8KzStt58Q=
github.com/streamingfast/logging v0.0.0-20220304214715-bc750a74b424/go.mod h1:VlduQ80JcGJSargkRU4Sg9Xo63wZD/l8A5NC/Uo1/uU=
Expand Down
3 changes: 2 additions & 1 deletion server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ func (s *GrpcServer) Run(ctx context.Context) {

streamHandlerGetter := func(opts ...connect.HandlerOption) (string, http.Handler) {
return pbbmsrvconnect.NewBlockHandler(s, opts...)

}

srv := connectweb.New([]connectweb.HandlerGetter{streamHandlerGetter}, options...)
addr := strings.ReplaceAll(s.httpListenAddr, "*", "")

Expand Down Expand Up @@ -141,6 +141,7 @@ func (s *GrpcServer) allowedOrigin(origin string) bool {
}

func (s *GrpcServer) healthCheck() dgrpcserver.HealthCheck {
s.logger.Debug("health checking")
return func(ctx context.Context) (isReady bool, out interface{}, err error) {
if derr.IsShuttingDown() {
return false, nil, nil
Expand Down

0 comments on commit 9d2c559

Please sign in to comment.