Skip to content
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

support filter MotanCluster.refers before refresh LoadBalance #410

Merged
merged 1 commit into from
Dec 26, 2024

Conversation

cocowh
Copy link
Contributor

@cocowh cocowh commented Dec 24, 2024

No description provided.

manageHandler.go Outdated
}
err := json.Unmarshal([]byte(configContent), &config)
if err != nil {
JSONError(w, "unmarshal request body failed.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

修改报错信息

core/util.go Outdated
@@ -194,21 +194,25 @@ func TrimSplit(s string, sep string) []string {
if sep == "" {
return strings.Split(s, sep)
}
n := strings.Count(s, sep) + 1
a := make([]string, n)
var a []string
i := 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

变量i已经无用了

if len(refersAfterFilter) > 0 {
refers = refersAfterFilter
}
vlog.Warningf("empty refers after filter, cluster: %s", m.url.GetIdentityWithRegistry())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个日志refers是否为空都会打印

@@ -405,6 +426,17 @@ func (m *MotanCluster) GetRuntimeInfo() map[string]interface{} {
return info
}

func (m *MotanCluster) SetRefersFilters(filter RefersFilter) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SetRefersFilters -> SetRefersFilter

manageHandler.go Outdated
return true
}
url := cls.GetURL()
refersFilters := config.ParseRefersFilters(url)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

refersFilters 改为 refersFilter

var rules []RefersFilterConfig
for _, filter := range list {
if (filter.Group == "" && filter.Service == "") || // global filter
(filter.Group != "" && filter.Group == clusterURL.Group) || // match group
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

逻辑不对

@cocowh cocowh force-pushed the sub_node_filter branch 2 times, most recently from 83dda8c to 3d9c4dd Compare December 25, 2024 03:34
support filter MotanCluster.refers before refresh LoadBalance

support filter MotanCluster.refers before refresh LoadBalance

code review

code review & bug fix
@rayzhang0603 rayzhang0603 merged commit bb1f26f into weibocom:dev Dec 26, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants