Skip to content

Commit

Permalink
Remove splice operation
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
barwin committed Feb 22, 2020
1 parent 79077f2 commit a246023
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit a246023

Please sign in to comment.