Skip to content

Commit

Permalink
Merge pull request #4448 from simbuerg/simbuerg/fix-double-dip-ratelimit
Browse files Browse the repository at this point in the history
[Fix] Avoid double-dip of nrcpt when calculating ratelimit condition
  • Loading branch information
vstakhov committed Mar 30, 2023
2 parents 415d763 + 092940e commit f62b23f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lualib/redis_scripts/ratelimit_check.lua
Expand Up @@ -62,7 +62,7 @@ if burst + pending > 0 then
if dynb == 0 then dynb = 0.0001 end

burst = burst + pending
if burst > 0 and (burst + nrcpt) > max_burst * dynb then
if burst > 0 and burst > max_burst * dynb then
return {1, tostring(burst - pending), tostring(dynr), tostring(dynb), tostring(leaked)}
end
-- Increase pending if we allow ratelimit
Expand Down

0 comments on commit f62b23f

Please sign in to comment.