diff --git a/source/scripts.ts b/source/scripts.ts index 7bd1b7b..a883c2d 100644 --- a/source/scripts.ts +++ b/source/scripts.ts @@ -9,7 +9,7 @@ const scripts = { increment: ` local totalHits = redis.call("INCR", KEYS[1]) local timeToExpire = redis.call("PTTL", KEYS[1]) - if timeToExpire <= 0 or ARGV[1] == "1" + if timeToExpire < 0 or ARGV[1] == "1" then redis.call("PEXPIRE", KEYS[1], tonumber(ARGV[2])) timeToExpire = tonumber(ARGV[2])