Skip to content

Commit 993d4b8

Browse files
committed
Ignore zero max message size in grpc config
Fixes upgrade issue where existing configs cause the max message size to get set to 0. Signed-off-by: Derek McGowan <[email protected]>
1 parent 5b1f69b commit 993d4b8

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)