Skip to content

Commit 78e4497

Browse files
committed
Fix lua script
1 parent ccd0bcc commit 78e4497

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lua.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ local new_tat = tat + increment
4343
local allow_at = new_tat - burst_offset
4444
4545
local diff = now - allow_at
46-
local remaining = math.floor(diff / emission_interval + 0.5)
46+
local remaining = diff / emission_interval
4747
4848
if remaining < 0 then
4949
local reset_after = tat - now
@@ -97,9 +97,9 @@ end
9797
tat = math.max(tat, now)
9898
9999
local diff = now - (tat - burst_offset)
100-
local remaining = math.floor(diff / emission_interval + 0.5)
100+
local remaining = diff / emission_interval
101101
102-
if remaining == 0 then
102+
if remaining < 1 then
103103
local reset_after = tat - now
104104
local retry_after = emission_interval - diff
105105
return {

0 commit comments

Comments
 (0)