mirror of https://github.com/milvus-io/milvus.git
Fix golint error in proxy (#9905)
Signed-off-by: zhenshan.cao <zhenshan.cao@zilliz.com>pull/10000/head
parent
56466508cc
commit
f6a836c784
|
@ -22,9 +22,12 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
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 {
|
type ParamTable struct {
|
||||||
paramtable.BaseTable
|
paramtable.BaseTable
|
||||||
|
|
||||||
|
@ -70,15 +73,19 @@ type ParamTable struct {
|
||||||
UpdatedTime time.Time
|
UpdatedTime time.Time
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Params is a package scoped variable of type ParamTable.
|
||||||
var Params ParamTable
|
var Params ParamTable
|
||||||
var once sync.Once
|
var once sync.Once
|
||||||
|
|
||||||
|
// InitOnce ensures that Init is only called once.
|
||||||
func (pt *ParamTable) InitOnce() {
|
func (pt *ParamTable) InitOnce() {
|
||||||
once.Do(func() {
|
once.Do(func() {
|
||||||
pt.Init()
|
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() {
|
func (pt *ParamTable) Init() {
|
||||||
pt.BaseTable.Init()
|
pt.BaseTable.Init()
|
||||||
err := pt.LoadYaml("advanced/proxy.yaml")
|
err := pt.LoadYaml("advanced/proxy.yaml")
|
||||||
|
@ -111,6 +118,7 @@ func (pt *ParamTable) Init() {
|
||||||
pt.initRoleName()
|
pt.initRoleName()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// InitAlias initialize Alias member.
|
||||||
func (pt *ParamTable) InitAlias(alias string) {
|
func (pt *ParamTable) InitAlias(alias string) {
|
||||||
pt.Alias = alias
|
pt.Alias = alias
|
||||||
}
|
}
|
||||||
|
@ -263,11 +271,11 @@ func (pt *ParamTable) initPulsarMaxMessageSize() {
|
||||||
|
|
||||||
maxMessageSizeStr, err := pt.Load("pulsar.maxMessageSize")
|
maxMessageSizeStr, err := pt.Load("pulsar.maxMessageSize")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
pt.PulsarMaxMessageSize = SuggestPulsarMaxMessageSizeKey
|
pt.PulsarMaxMessageSize = SuggestPulsarMaxMessageSize
|
||||||
} else {
|
} else {
|
||||||
maxMessageSize, err := strconv.Atoi(maxMessageSizeStr)
|
maxMessageSize, err := strconv.Atoi(maxMessageSizeStr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
pt.PulsarMaxMessageSize = SuggestPulsarMaxMessageSizeKey
|
pt.PulsarMaxMessageSize = SuggestPulsarMaxMessageSize
|
||||||
} else {
|
} else {
|
||||||
pt.PulsarMaxMessageSize = maxMessageSize
|
pt.PulsarMaxMessageSize = maxMessageSize
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue