Fixed - RateLimiter throws LUA-script error #3444

pull/3941/head
Nikita Koksharov 4 years ago
parent 09f733965e
commit c7fd86e289

@ -211,7 +211,7 @@ public class RedissonRateLimiter extends RedissonExpirable implements RRateLimit
+ "end;"
+ "if tonumber(currentValue) < tonumber(ARGV[1]) then "
+ "local nearest = redis.call('zrangebyscore', permitsName, '(' .. (tonumber(ARGV[2]) - interval), tonumber(ARGV[2]), 'withscores', 'limit', 0, 1); "
+ "local nearest = redis.call('zrangebyscore', permitsName, '(' .. (tonumber(ARGV[2]) - interval), '+inf', 'withscores', 'limit', 0, 1); "
+ "local random, permits = struct.unpack('fI', nearest[1]);"
+ "return tonumber(nearest[2]) - (tonumber(ARGV[2]) - interval);"
+ "else "

Loading…
Cancel
Save