Skip to content

Commit

Permalink
chore: increase grpc max call send & receive msg size
Browse files Browse the repository at this point in the history
  • Loading branch information
bsushmith committed Dec 14, 2022
1 parent f01ec6f commit 79369e1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ require (
go.uber.org/multierr v1.8.0 // indirect
go.uber.org/zap v1.21.0 // indirect
golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e // indirect
golang.org/x/net v0.0.0-20220919232410-f2f64ebce3c1
golang.org/x/term v0.0.0-20220526004731-065cf7ba2467 // indirect
google.golang.org/genproto v0.0.0-20220822174746-9e6da59bd2fc
google.golang.org/grpc v1.49.0
Expand Down
13 changes: 12 additions & 1 deletion internal/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ import (
"google.golang.org/protobuf/encoding/protojson"
)

const (
GRPCMaxClientSendSize = 32 << 20
)

type Config struct {
Host string `mapstructure:"host" default:"0.0.0.0"`
Port int `mapstructure:"port" default:"8080"`
Expand Down Expand Up @@ -100,7 +104,14 @@ func Serve(

headerMatcher := makeHeaderMatcher(config)

grpcConn, err := grpc.DialContext(grpcDialCtx, config.grpcAddr(), grpc.WithTransportCredentials(insecure.NewCredentials()))
grpcConn, err := grpc.DialContext(
grpcDialCtx,
config.grpcAddr(),
grpc.WithTransportCredentials(insecure.NewCredentials()),
grpc.WithDefaultCallOptions(
grpc.MaxCallRecvMsgSize(GRPCMaxClientSendSize),
grpc.MaxCallSendMsgSize(GRPCMaxClientSendSize),
))
if err != nil {
return err
}
Expand Down

0 comments on commit 79369e1

Please sign in to comment.