Skip to content
This repository has been archived by the owner on Aug 26, 2022. It is now read-only.

Commit

Permalink
mode add default
Browse files Browse the repository at this point in the history
  • Loading branch information
huangnauh committed May 24, 2018
1 parent 481b0e2 commit dc60762
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion nginx/app/lib/resty/checkups/try.lua
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@ local function prepare_callbacks(skey, opts)
local mode = ups.mode
local next_server_func = round_robin.next_round_robin_server
local key
if mode ~= nil then
if not mode or mode == "" then
mode = "rr"
end

if mode ~= "rr" then
if mode == "hash" then
key = opts.hash_key or ngx.var.uri
elseif mode == "url_hash" then
Expand All @@ -73,6 +77,8 @@ local function prepare_callbacks(skey, opts)
key = ngx.var.remote_addr
elseif mode == "header_hash" then
key = ngx.var.http_x_hash_key or ngx.var.uri
else
key = ngx.var.uri
end

next_server_func = consistent_hash.next_consistent_hash_server
Expand Down

0 comments on commit dc60762

Please sign in to comment.