Skip to content

Commit

Permalink
adjust reset_ms based on fixed_window
Browse files Browse the repository at this point in the history
  • Loading branch information
pubalokta committed Sep 26, 2024
1 parent 47d1422 commit ff5599e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/take.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ redis.call('HMSET', KEYS[1],
redis.call('EXPIRE', KEYS[1], ttl)

local reset_ms = 0
if drip_interval > 0 then
if fixed_window > 0 then
reset_ms = current_timestamp_ms + fixed_window
elseif drip_interval > 0 then
reset_ms = math.ceil(current_timestamp_ms + (bucket_size - new_content) * drip_interval)
end

Expand Down

0 comments on commit ff5599e

Please sign in to comment.