openresty / lua-resty-limit-traffic

Lua library for limiting and controlling traffic in OpenResty/ngx_lua
819 stars 150 forks source link

feature: resty.limit.count counts made instead of remaining requests #34

Open mikz opened 6 years ago

mikz commented 6 years ago

by keeping track of requests that were made instead of remaining ones it is possible to change the limit on the fly and share one counter between several count limiters with different limits

It is possible all the details are not right, I didn't really understand the part of calling DICT:expire. But I'd at least like to verify the approach and open a discussion.

ref: https://github.com/openresty/lua-resty-limit-traffic/issues/23#issuecomment-389069514

rainingmaster commented 3 years ago

Hi @mikz Sorry for our delay

I think this PR is good for us to share a counter for difference rate limit policy, just like limit:conn.

And could you split the incr to difference version like here, and the old version Openresty could be supported too.

mikz commented 3 years ago

@rainingmaster thanks for the feedback. I no longer work on this, but someone from https://github.com/3scale/APIcast could take over. /cc @eloycoto