mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-06 22:07:55 +00:00
fix(api): do sliding window rate limiting correctly (hopefully)
This commit is contained in:
parent
873643153d
commit
21d647f423
2 changed files with 9 additions and 15 deletions
|
|
@ -2,13 +2,11 @@
|
|||
-- redis.replicate_commands()
|
||||
|
||||
local rate_limit_key = KEYS[1]
|
||||
local burst = ARGV[1]
|
||||
local rate = ARGV[2]
|
||||
local period = ARGV[3]
|
||||
local rate = ARGV[1]
|
||||
local period = ARGV[2]
|
||||
local cost = tonumber(ARGV[3])
|
||||
|
||||
-- we're only ever asking for 1 request at a time
|
||||
-- todo: this is no longer true
|
||||
local cost = 1 --local cost = tonumber(ARGV[4])
|
||||
local burst = rate
|
||||
|
||||
local emission_interval = period / rate
|
||||
local increment = emission_interval * cost
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue