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

feature: ignored upstream nodes with a weight of 0. #536

Merged
merged 4 commits into from
Sep 18, 2019
Merged

feature: ignored upstream nodes with a weight of 0. #536

merged 4 commits into from
Sep 18, 2019

Conversation

membphis
Copy link
Member

No description provided.

Copy link
Member

@moonming moonming left a comment

Choose a reason for hiding this comment

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

need to add doc and test cases.

@moonming
Copy link
Member

fixed #532

@membphis membphis added this to the ver 0.8 milestone Sep 18, 2019
if weight > 0 then
up_nodes[addr] = weight
end
end
return upstream.nodes
Copy link
Contributor

Choose a reason for hiding this comment

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

Here should return up_nodes

Copy link
Member Author

Choose a reason for hiding this comment

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

old implementation is enough, it support weight equal 0 case already. we do not need to patch here, I reverted those new code.

if weight > 0 then
up_nodes[addr] = weight
end
end
return upstream.nodes
end

local host = upstream.checks and upstream.checks.host
local up_nodes = core.table.new(0, #upstream.nodes)
Copy link
Contributor

@chnliyong chnliyong Sep 18, 2019

Choose a reason for hiding this comment

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

This statement likely duplicate

Copy link
Member Author

Choose a reason for hiding this comment

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

ditto

"127.0.0.1:1980": 1,
"127.0.0.1:1981": 0,
"127.0.0.1:1982": 0
}
Copy link
Member

Choose a reason for hiding this comment

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

need to check the nodes wrote into etcd.

Copy link
Member Author

Choose a reason for hiding this comment

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

"type": "roundrobin",
"nodes": {
"127.0.0.1:1980": 3,
"127.0.0.1:1981": 0,
Copy link
Member

Choose a reason for hiding this comment

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

the admin API will return 127.0.0.1:1981 or not? we need add test cases for that.

Copy link
Member Author

Choose a reason for hiding this comment

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

current implementation is enough, it supports weight equal 0 now.
@membphis membphis merged commit 681a42c into apache:master Sep 18, 2019
@membphis membphis deleted the upstream-weight-0 branch September 18, 2019 04:06
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.

3 participants