diff --git a/.travis.yml b/.travis.yml index 04b39cd..f545ef6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,9 +2,10 @@ language: node_js node_js: - "0.10" - "0.12" - - "4.2" + - "4" + - "5" services: - - redis-server + - redis-server install: - npm install script: diff --git a/index.js b/index.js index 687c467..2b1c370 100644 --- a/index.js +++ b/index.js @@ -68,7 +68,7 @@ Limiter.prototype.get = function (fn) { function create() { var ex = (Date.now() + duration) / 1000 | 0; - db.multi() + db.multi() .set([count, max, 'PX', duration, 'NX']) .set([limit, max, 'PX', duration, 'NX']) .set([reset, ex, 'PX', duration, 'NX']) @@ -116,15 +116,15 @@ Limiter.prototype.get = function (fn) { } function mget() { - db.watch([count], function (err) { - if (err) return fn(err); - db.mget([count, limit, reset], function (err, res) { - if (err) return fn(err); - if (!res[0] && res[0] !== 0) return create(); - - decr(res); - }); - }); + db.watch([count], function (err) { + if (err) return fn(err); + db.mget([count, limit, reset], function (err, res) { + if (err) return fn(err); + if (!res[0] && res[0] !== 0) return create(); + + decr(res); + }); + }); } mget(); diff --git a/package.json b/package.json index f6994a5..25e7be9 100644 --- a/package.json +++ b/package.json @@ -11,9 +11,9 @@ ], "dependencies": {}, "devDependencies": { - "ioredis": "1.9.0", + "ioredis": "^1.15.1", "mocha": "*", - "redis": "0.10.2", + "redis": "^2.6.0-1", "should": "*" }, "license": "MIT",