1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-07 13:22:56 +03:00

Add test and fix keeping the offline queue

Use a new delay after reconnecting
This commit is contained in:
Ruben Bridgewater
2015-09-10 19:19:09 +02:00
parent 3c2ba8c373
commit 55d0036eae
4 changed files with 49 additions and 26 deletions

View File

@@ -11,7 +11,7 @@ describe("on lost connection", function () {
describe("using " + parser + " and " + ip, function () {
it("emit an error after max retry attempts and do not try to reconnect afterwards", function (done) {
var max_attempts = 3;
var max_attempts = 4;
var client = redis.createClient({
parser: parser,
max_attempts: max_attempts
@@ -31,7 +31,7 @@ describe("on lost connection", function () {
client.on('error', function(err) {
if (/Redis connection in broken state: maximum connection attempts.*?exceeded./.test(err.message)) {
setTimeout(function () {
assert.strictEqual(calls, max_attempts);
assert.strictEqual(calls, max_attempts - 1);
done();
}, 1500);
}
@@ -40,7 +40,7 @@ describe("on lost connection", function () {
it("emit an error after max retry timeout and do not try to reconnect afterwards", function (done) {
var connect_timeout = 1000; // in ms
var client = redis.createClient({
client = redis.createClient({
parser: parser,
connect_timeout: connect_timeout
});