Skip to content

Commit b867977

Browse files
authored
Merge pull request #2380 from dmcgowan/ignore-zero-msg-size-configs
Ignore zero max message size in grpc config
2 parents 5b1f69b + 993d4b8 commit b867977

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

services/server/server.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,18 @@ func New(ctx context.Context, config *Config) (*Server, error) {
6666
if err != nil {
6767
return nil, err
6868
}
69-
rpc := grpc.NewServer(
70-
grpc.MaxRecvMsgSize(config.GRPC.MaxRecvMsgSize),
71-
grpc.MaxSendMsgSize(config.GRPC.MaxSendMsgSize),
69+
70+
serverOpts := []grpc.ServerOption{
7271
grpc.UnaryInterceptor(grpc_prometheus.UnaryServerInterceptor),
7372
grpc.StreamInterceptor(grpc_prometheus.StreamServerInterceptor),
74-
)
73+
}
74+
if config.GRPC.MaxRecvMsgSize > 0 {
75+
serverOpts = append(serverOpts, grpc.MaxRecvMsgSize(config.GRPC.MaxRecvMsgSize))
76+
}
77+
if config.GRPC.MaxSendMsgSize > 0 {
78+
serverOpts = append(serverOpts, grpc.MaxSendMsgSize(config.GRPC.MaxSendMsgSize))
79+
}
80+
rpc := grpc.NewServer(serverOpts...)
7581
var (
7682
services []plugin.Service
7783
s = &Server{

0 commit comments

Comments
 (0)