-
Notifications
You must be signed in to change notification settings - Fork 170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve rate limit policy #679
Conversation
@@ -10,6 +10,10 @@ local limit_traffic = require "resty.limit.traffic" | |||
local ts = require ('apicast.threescale_utils') | |||
local tonumber = tonumber | |||
local next = next | |||
local format = string.format | |||
local insert = table.insert | |||
local os_date = os.date |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to use ngx.time
or ngx.now
as they are way more performant in scope of OpenResty.
@@ -234,6 +234,7 @@ describe('Rate limit policy', function() | |||
assert.equal('10', window) | |||
|
|||
os.execute("sleep 1") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't noticed this earlier. There is ngx.sleep()
that is better than spawning a subprocess.
57a3255
to
d2ee92a
Compare
9c49ac2
to
feae81d
Compare
@mikz The |
@y-tabata The error has nothing to do with your PR, sorry. |
@mikz Sure, no problem. |
move to #703 |
This PR improves the rate limit policy according to the comments of PR #665 and addresses to Issue #667.