diff --git a/pkg/app/options/corredor.go b/pkg/app/options/corredor.go index 3102037d1..bfdfd0939 100644 --- a/pkg/app/options/corredor.go +++ b/pkg/app/options/corredor.go @@ -17,6 +17,8 @@ type ( MaxBackoffDelay time.Duration `env:"CORREDOR_MAX_BACKOFF_DELAY"` + MaxReceiveMessageSize int `env:"CORREDOR_MAX_RECEIVE_MESSAGE_SIZE"` + DefaultExecTimeout time.Duration `env:"CORREDOR_DEFAULT_EXEC_TIMEOUT"` ListTimeout time.Duration `env:"CORREDOR_LIST_TIMEOUT"` @@ -36,14 +38,15 @@ type ( func Corredor() (o *CorredorOpt) { o = &CorredorOpt{ - Enabled: true, - RunAsEnabled: true, - Addr: "localhost:50051", - MaxBackoffDelay: time.Minute, - DefaultExecTimeout: time.Minute, - ListTimeout: time.Second * 2, - ListRefresh: time.Second * 5, - Log: false, + Enabled: true, + RunAsEnabled: true, + Addr: "localhost:50051", + MaxBackoffDelay: time.Minute, + MaxReceiveMessageSize: 2 << 23, // 16MB + DefaultExecTimeout: time.Minute, + ListTimeout: time.Second * 2, + ListRefresh: time.Second * 5, + Log: false, TlsCertEnabled: true, TlsCertPath: "/certs/corredor/client", diff --git a/pkg/corredor/conn.go b/pkg/corredor/conn.go index 329e0afd6..839dded3f 100644 --- a/pkg/corredor/conn.go +++ b/pkg/corredor/conn.go @@ -81,6 +81,10 @@ func NewConnection(ctx context.Context, opt options.CorredorOpt, logger *zap.Log dialOpts = append(dialOpts, grpc.WithInsecure()) } + if opt.MaxReceiveMessageSize > 0 { + grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(opt.MaxReceiveMessageSize)) + } + if opt.MaxBackoffDelay > 0 { dialOpts = append(dialOpts, grpc.WithBackoffMaxDelay(opt.MaxBackoffDelay)) }