Remove a pair of spurious SET calls in the rate limiter script.

This commit is contained in:
Jon Chambers
2020-07-07 15:32:50 -04:00
committed by Jon Chambers
parent b4437d9cfd
commit 3bca856e87

View File

@@ -21,9 +21,6 @@ end
local elapsedTime = currentTimeMillis - leakyBucket["lastUpdateTimeMillis"]
local updatedSpaceRemaining = math.min(leakyBucket["bucketSize"], math.floor(leakyBucket["spaceRemaining"] + (elapsedTime * leakyBucket["leakRatePerMillis"])))
redis.call("SET", "elapsedTime", elapsedTime)
redis.call("SET", "updatedSpaceRemaining", updatedSpaceRemaining)
if updatedSpaceRemaining >= amount then
leakyBucket["spaceRemaining"] = updatedSpaceRemaining - amount
redis.call("SET", bucketId, cjson.encode(leakyBucket))