change: rename plugin's balancer method to before_proxy (#4697)

This is confusing to have plugin's balancer method and user-defined
balancer.

Signed-off-by: spacewander <spacewanderlzx@gmail.com>
This commit is contained in:
罗泽轩 2021-07-29 19:06:14 +08:00 committed by GitHub
parent 6655a35889
commit e1d9f35f60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 6 deletions

View File

@ -321,7 +321,7 @@ function _M.run(route, ctx, plugin_funcs)
end
end
local _, run = plugin_funcs("balancer")
local _, run = plugin_funcs("before_proxy")
-- always recreate request as the request may be changed by plugins
if (run or header_changed) and balancer.recreate_request then
balancer.recreate_request()

View File

@ -518,8 +518,8 @@ function _M.http_access_phase()
set_upstream_headers(api_ctx, server)
-- run the balancer phase in access phase first to avoid always reinit request
common_phase("balancer")
-- run the before_proxy method in access phase first to avoid always reinit request
common_phase("before_proxy")
local ref = ctxdump.stash_ngx_ctx()
core.log.info("stash ngx ctx: ", ref)
@ -913,8 +913,8 @@ function _M.stream_preread_phase()
api_ctx.picked_server = server
-- run the balancer phase in preread phase first to avoid always reinit request
common_phase("balancer")
-- run the before_proxy method in preread phase first to avoid always reinit request
common_phase("before_proxy")
end

View File

@ -113,7 +113,7 @@ return function(plugin_name, priority)
call_funcs('access', conf, ctx)
end
function _M.balancer(conf, ctx)
function _M.before_proxy(conf, ctx)
call_funcs('balancer', conf, ctx)
end