未验证 提交 f6a836c7 编写于 作者: Z zhenshan.cao 提交者: GitHub

Fix golint error in proxy (#9905)

Signed-off-by: Nzhenshan.cao <zhenshan.cao@zilliz.com>
上级 56466508
......@@ -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
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册