hello
用 https://github.com/openresty/lua-resty-limit-traffic/ 做动态限速, 如何动态设定conn 和burst?
在wiki里面提到:
one can still share a single instance as long as he always calls the set_conn and/or set_burst methods right before the incoming call.
设定conn和burst 需要在调用incoming之前,
src/access.lua
local mylimit_conn = require "mylimit_conn" //在这里面生成唯一的lim实例,module level级别供worker内部共享。
local lim = mylimit_conn.lim
lim:incoming(key, true)
server {
access_by_lua_file "src/acces.lua"
}
问题是:每个请求都会调用incoming,如果在之前调用set_conn来设定呢?直接代码写在incoming之前么?这貌似不是方法吧。
请教如何设定?