Skip to content

Commit 0112888

Browse files
ttl fix
Signed-off-by: Abhishek Choudhary <shreemaan.abhishek@gmail.com>
1 parent 72d4dfc commit 0112888

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

apisix/plugins/limit-req/util.lua

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,7 @@ function _M.incoming(self, red, key, commit)
5757
end
5858

5959
if commit then
60-
-- limit-req does rate limiting per second, so we set the ttl to 2 seconds
61-
local ttl = 2
60+
local ttl = math.ceil(self.burst / self.rate) + 1
6261
local ok, err
6362

6463
ok, err = red:set(excess_key, excess, "EX", ttl)

0 commit comments

Comments
 (0)