Update RedissonRateLimiter.java

removed  meaningless struct.unpack() calls in lua script

Signed-off-by: lxk-ecs <69671710@qq.com>
pull/3554/head
LiuXiongKang 4 years ago committed by lxk-ecs
parent 40ffeeb05d
commit eb69868858

@ -212,7 +212,6 @@ public class RedissonRateLimiter extends RedissonExpirable implements RRateLimit
+ "if tonumber(currentValue) < tonumber(ARGV[1]) then "
+ "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 "
+ "redis.call('zadd', permitsName, ARGV[2], struct.pack('fI', ARGV[3], ARGV[1])); "

Loading…
Cancel
Save