1.取消使用lua内置的字符串串切割方式,使用openresty自带的ngx.re.split方法,提高性能和代码阅读性 2.注释一段无用的代码 #5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
local ret = tools.match('/'..svc_code,elem['uri'])这行代码无用,可以取消掉。该函数内部使用了Lua自带的模式匹配,这不仅是出于性能方面的考虑(不能被 JIT,而且被编译过一次的模式也不会被缓存),还因为 Lua 自带的正则是自成体系的,并非 PCRE 规范,这对于绝大部分开发者来说都是徒增烦恼。