Skip to content

Commit

Permalink
Merge pull request #4549 from fatalbanana/ratelimit
Browse files Browse the repository at this point in the history
[Minor] Minor fixes for previous ratelimit changes
  • Loading branch information
vstakhov committed Jul 25, 2023
2 parents 0d8cabe + ee665b0 commit 5a23ddd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lualib/redis_scripts/ratelimit_cleanup_pending.lua
Expand Up @@ -22,7 +22,7 @@ pending = tonumber(pending or '0')
if pending < nrcpt then pending = 0 else pending = pending - nrcpt end

-- 3. Set the updated values back to Redis and update the expiration time for the bucket
redis.call('HMSET', prefix, tostring(pending), 'l', KEYS[2])
redis.call('HMSET', prefix, 'p', tostring(pending), 'l', KEYS[2])
redis.call('EXPIRE', prefix, KEYS[3])

-- 4. Return the updated pending value
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/lua/ratelimit.lua
Expand Up @@ -544,7 +544,7 @@ local function maybe_cleanup_pending(task)
if task:cache_get('ratelimit_bucket_touched') then
local prefixes = task:cache_get('ratelimit_prefixes')
if prefixes then
for k, v in pairs(prefixes) or E do
for k, v in pairs(prefixes) do
local bucket = v.bucket
local function cleanup_cb(err, data)
if err then
Expand Down

0 comments on commit 5a23ddd

Please sign in to comment.