-
Notifications
You must be signed in to change notification settings - Fork 80
configurable grpc buffer #727
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
defaultWriteBufSize = 32 * 1024 | ||
defaultReadBufSize = 32 * 1024 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove, no need to override golang defaults
a.RootCmd.PersistentFlags().StringArrayVarP(&a.Config.GlobalFlags.Exclude, "exclude", "", nil, "YANG module names to be excluded") | ||
|
||
a.RootCmd.PersistentFlags().UintVarP(&a.Config.GlobalFlags.TargetGRPCWriteBufferSize, "target-grpc-write-buffer-size", "", defaultWriteBufSize, "gRPC write buffer size for the target connection") | ||
a.RootCmd.PersistentFlags().UintVarP(&a.Config.GlobalFlags.TrgetGRPCReadBufferSize, "target-grpc-read-buffer-size", "", defaultReadBufSize, "gRPC read buffer size for the target connection") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you need a global flag for this? not everything has to be exposed as an argument. this can be a config file only option.
but if you do, use int
and -1
as the default value.
also, there's typo in the word target
(&a.Config.GlobalFlags.TrgetGRPCReadBufferSize
)
Subscriptions []string `mapstructure:"subscriptions,omitempty" yaml:"subscriptions,omitempty" json:"subscriptions,omitempty"` | ||
Outputs []string `mapstructure:"outputs,omitempty" yaml:"outputs,omitempty" json:"outputs,omitempty"` | ||
BufferSize uint `mapstructure:"buffer-size,omitempty" yaml:"buffer-size,omitempty" json:"buffer-size,omitempty"` | ||
GRPCReadBufferSize uint `mapstructure:"grpc-read-buffer-size,omitempty" yaml:"grpc-read-buffer-size,omitempty" json:"grpc-read-buffer-size,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*int
instad of uint
})) | ||
} | ||
// Read write Buffer size, every value of type uint is >= 0 | ||
tOpts = append(tOpts, grpc.WithReadBufferSize(int(tc.GRPCReadBufferSize))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add a non-nil check after adding the pointer to the struct;
if you decide to keep the global argument with the new default (-1
) - also add a non-negative check instead of int(uint)
conversion
No description provided.