Firstsawyou commented on a change in pull request #3512:
URL: https://github.com/apache/apisix/pull/3512#discussion_r571553352
##########
File path: apisix/plugins/traffic-split.lua
##########
@@ -258,18 +258,21 @@ end
local function new_rr_obj(weighted_upstreams)
local server_list = {}
for i, upstream_obj in ipairs(weighted_upstreams) do
- if not upstream_obj.upstream then
+ if not upstream_obj.upstream and not upstream_obj.upstream_id then
-- If the `upstream` object has only the `weight` value, it means
-- that the `upstream` weight value on the default `route` has
been reached.
- -- Need to set an identifier to mark the empty upstream.
- upstream_obj.upstream = "empty_upstream"
+ -- Mark empty upstream services in the plugin, but with weight.
+ upstream_obj.upstream = "plugin#upstream#is#empty"
+ server_list[upstream_obj.upstream] = upstream_obj.weight
end
- if type(upstream_obj.upstream) == "table" then
+ if upstream_obj.upstream_id then
+ server_list[upstream_obj.upstream_id] = upstream_obj.weight
+ elseif type(upstream_obj.upstream) == "table" then
Review comment:
updated.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]