mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-02 11:59:00 +08:00
Fix golint error in proxy (#9905)
Signed-off-by: zhenshan.cao <zhenshan.cao@zilliz.com>
This commit is contained in:
parent
56466508cc
commit
f6a836c784
@ -22,9 +22,12 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
SuggestPulsarMaxMessageSizeKey = 5 * 1024 * 1024
|
||||
// SuggestPulsarMaxMessageSize defines the maximum size of Pulsar message.
|
||||
SuggestPulsarMaxMessageSize = 5 * 1024 * 1024
|
||||
)
|
||||
|
||||
// ParamTable is a derived struct of paramtable.BaseTable. It achieves Composition by
|
||||
// embedding paramtable.BaseTable. It is used to quickly and easily access the system configuration.
|
||||
type ParamTable struct {
|
||||
paramtable.BaseTable
|
||||
|
||||
@ -70,15 +73,19 @@ type ParamTable struct {
|
||||
UpdatedTime time.Time
|
||||
}
|
||||
|
||||
// Params is a package scoped variable of type ParamTable.
|
||||
var Params ParamTable
|
||||
var once sync.Once
|
||||
|
||||
// InitOnce ensures that Init is only called once.
|
||||
func (pt *ParamTable) InitOnce() {
|
||||
once.Do(func() {
|
||||
pt.Init()
|
||||
})
|
||||
}
|
||||
|
||||
// Init is an override method of BaseTable's Init. It mainly calls the
|
||||
// Init of BaseTable and do some other initialization.
|
||||
func (pt *ParamTable) Init() {
|
||||
pt.BaseTable.Init()
|
||||
err := pt.LoadYaml("advanced/proxy.yaml")
|
||||
@ -111,6 +118,7 @@ func (pt *ParamTable) Init() {
|
||||
pt.initRoleName()
|
||||
}
|
||||
|
||||
// InitAlias initialize Alias member.
|
||||
func (pt *ParamTable) InitAlias(alias string) {
|
||||
pt.Alias = alias
|
||||
}
|
||||
@ -263,11 +271,11 @@ func (pt *ParamTable) initPulsarMaxMessageSize() {
|
||||
|
||||
maxMessageSizeStr, err := pt.Load("pulsar.maxMessageSize")
|
||||
if err != nil {
|
||||
pt.PulsarMaxMessageSize = SuggestPulsarMaxMessageSizeKey
|
||||
pt.PulsarMaxMessageSize = SuggestPulsarMaxMessageSize
|
||||
} else {
|
||||
maxMessageSize, err := strconv.Atoi(maxMessageSizeStr)
|
||||
if err != nil {
|
||||
pt.PulsarMaxMessageSize = SuggestPulsarMaxMessageSizeKey
|
||||
pt.PulsarMaxMessageSize = SuggestPulsarMaxMessageSize
|
||||
} else {
|
||||
pt.PulsarMaxMessageSize = maxMessageSize
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user