summaryrefslogtreecommitdiffstats
path: root/msb-core/openresty-ext/src
diff options
context:
space:
mode:
authorYonggangWang <wang.yonggang131@zte.com.cn>2016-09-14 14:37:01 +0800
committerYonggangWang <wang.yonggang131@zte.com.cn>2016-09-14 14:37:01 +0800
commit92cf7b5ae9f6354ba82f2c1e30fc952de233f515 (patch)
treec4431661c814abacfc5d5eab9f07ef5dc1598f80 /msb-core/openresty-ext/src
parent382f337fe4c4e20928636832520908f81975d5c7 (diff)
update comments in the lua code
Change-Id: I950a141a50825484e4ab3d8871ad427e977c31dc Signed-off-by: YonggangWang <wang.yonggang131@zte.com.cn>
Diffstat (limited to 'msb-core/openresty-ext/src')
-rw-r--r--msb-core/openresty-ext/src/assembly/resources/openresty/nginx/luaext/customrouter.lua7
1 files changed, 0 insertions, 7 deletions
diff --git a/msb-core/openresty-ext/src/assembly/resources/openresty/nginx/luaext/customrouter.lua b/msb-core/openresty-ext/src/assembly/resources/openresty/nginx/luaext/customrouter.lua
index d1f476a..d6b67f3 100644
--- a/msb-core/openresty-ext/src/assembly/resources/openresty/nginx/luaext/customrouter.lua
+++ b/msb-core/openresty-ext/src/assembly/resources/openresty/nginx/luaext/customrouter.lua
@@ -82,22 +82,17 @@ local function query_allkeys_updatecache(red)
ngx.log(ngx.ERR,err)
return ""
end
- --把所有键值处理后放到集合中,去除重复
local key_set={}
for key, value in ipairs(allkeys) do
name = string.gsub(string.gsub(string.gsub(value,"msb:routing:custom:",""),":info",""),":lb:server1","")
key_set[name]=true
end
- --取出所有的�?放到table中准备排�?
local key_table = {}
local index = 1
for key,_ in pairs(key_set) do
- --为了避免效率问题,暂时不用table.insert()
- --table.insert(key_table,key)
key_table[index] = key
index = index + 1
end
- --对所有键进行倒序排序,用于实现最长前缀匹配
table.sort(key_table, function (a, b)
return a > b
end)
@@ -154,11 +149,9 @@ local function query_router_info()
end
local delimiter = "<>"
- -- '.-' 表示最短匹�?
for key in string.gmatch(servicenames,"(.-)"..delimiter) do
ngx.log(ngx.WARN, "==key_table key:", key)
local from, to, err = ngx.re.find(uri, "^"..key.."(/(.*))?$", "jo")
- --判断key是否为输入uri�?前缀"
if from then
ngx.log(ngx.WARN,"Matched! start-end:",from,"-",to)
local result = query_ipurl_updatecache(red,key)