-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Conversation
There was a problem hiding this 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.
fixed #532 |
lua/apisix/balancer.lua
Outdated
if weight > 0 then | ||
up_nodes[addr] = weight | ||
end | ||
end | ||
return upstream.nodes |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
lua/apisix/balancer.lua
Outdated
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This statement likely duplicate
There was a problem hiding this comment.
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 | ||
} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
No description provided.