From a24602352208d3e76814fc34e114980d1acc048f Mon Sep 17 00:00:00 2001 From: Ben Arwin Date: Sat, 22 Feb 2020 10:13:52 -0800 Subject: [PATCH] Remove splice operation The `.splice()` was necessary when the `tidy` option was available. But since b958870, `zremrangebyrank` is always run, so it can live in the operations array by default. --- index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 8a6a12a..0efcc58 100644 --- a/index.js +++ b/index.js @@ -69,10 +69,10 @@ Limiter.prototype.get = function (fn) { ['zadd', key, now, now], ['zrange', key, 0, 0], ['zrange', key, -max, -max], + ['zremrangebyrank', key, 0, -(max + 1)], ['pexpire', key, duration], ] - - operations.splice(5, 0, ['zremrangebyrank', key, 0, -(max + 1)]) + db.multi(operations) .exec(function (err, res) { if (err) return fn(err);