Skip to content

Commit

Permalink
🐛 increase message size for grpc (#673) (#675)
Browse files Browse the repository at this point in the history
Signed-off-by: Pranav Gaikwad <[email protected]>
Signed-off-by: Cherry Picker <[email protected]>

Signed-off-by: Pranav Gaikwad <[email protected]>
Signed-off-by: Cherry Picker <[email protected]>
Co-authored-by: Pranav Gaikwad <[email protected]>
  • Loading branch information
konveyor-ci-bot[bot] and pranavgaikwad authored Jul 25, 2024
1 parent 37f30f6 commit 1e1de5a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
16 changes: 12 additions & 4 deletions provider/grpc/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,15 +259,19 @@ func start(ctx context.Context, config provider.Config) (*grpc.ClientConn, io.Re
if err != nil {
return nil, nil, err
}
conn, err := grpc.Dial(fmt.Sprintf("localhost:%v", port), grpc.WithTransportCredentials(insecure.NewCredentials()))
conn, err := grpc.Dial(fmt.Sprintf("localhost:%v", port),
grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(provider.MAX_MESSAGE_SIZE)),
grpc.WithTransportCredentials(insecure.NewCredentials()))
if err != nil {
log.Fatalf("did not connect: %v", err)
}
return conn, out, nil
}
if config.Address != "" {
if config.CertPath == "" {
conn, err := grpc.Dial(fmt.Sprintf(config.Address), grpc.WithTransportCredentials(insecure.NewCredentials()))
conn, err := grpc.Dial(fmt.Sprintf(config.Address),
grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(provider.MAX_MESSAGE_SIZE)),
grpc.WithTransportCredentials(insecure.NewCredentials()))
if err != nil {
log.Fatalf("did not connect: %v", err)
}
Expand All @@ -278,7 +282,9 @@ func start(ctx context.Context, config provider.Config) (*grpc.ClientConn, io.Re
return nil, nil, err
}
if config.JWTToken == "" {
conn, err := grpc.Dial(fmt.Sprintf(config.Address), grpc.WithTransportCredentials(creds))
conn, err := grpc.Dial(fmt.Sprintf(config.Address),
grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(provider.MAX_MESSAGE_SIZE)),
grpc.WithTransportCredentials(creds))
if err != nil {
log.Fatalf("did not connect: %v", err)
}
Expand All @@ -288,7 +294,9 @@ func start(ctx context.Context, config provider.Config) (*grpc.ClientConn, io.Re
i := &jwtTokeInterceptor{
Token: config.JWTToken,
}
conn, err := grpc.Dial(fmt.Sprintf(config.Address), grpc.WithTransportCredentials(creds), grpc.WithUnaryInterceptor(i.unaryInterceptor))
conn, err := grpc.Dial(fmt.Sprintf(config.Address),
grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(provider.MAX_MESSAGE_SIZE)),
grpc.WithTransportCredentials(creds), grpc.WithUnaryInterceptor(i.unaryInterceptor))
if err != nil {
log.Fatalf("did not connect: %v", err)
}
Expand Down
3 changes: 2 additions & 1 deletion provider/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (

const (
JWT_SECRET_ENV_VAR = "JWT_SECRET"
MAX_MESSAGE_SIZE = 1024 * 1024 * 8
)

type Server interface {
Expand Down Expand Up @@ -116,7 +117,7 @@ func (s *server) Start(ctx context.Context) error {
gs = grpc.NewServer(grpc.Creds(creds))
}
} else if s.CertPath == "" && s.KeyPath == "" {
gs = grpc.NewServer()
gs = grpc.NewServer(grpc.MaxRecvMsgSize(MAX_MESSAGE_SIZE), grpc.MaxSendMsgSize(MAX_MESSAGE_SIZE))
} else {
return fmt.Errorf("cert: %v, and key: %v are invalid", s.CertPath, s.KeyPath)
}
Expand Down

0 comments on commit 1e1de5a

Please sign in to comment.