Add capability to set CORREDOR_MAX_RECEIVE_MESSAGE_SIZE, set default to 16MB
This commit is contained in:
parent
7f0fcc72b9
commit
2aee9f80b9
@ -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",
|
||||
|
||||
@ -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))
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user