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

Add retry_max_delay option

- add option
- add test
This commit is contained in:
Tomasz Durka
2013-03-12 12:31:19 +01:00
parent 92ed0befc1
commit 38dbacac9f
2 changed files with 31 additions and 2 deletions

22
test.js
View File

@@ -1798,6 +1798,28 @@ tests.auth = function () {
});
};
tests.reconnectRetryMaxDelay = function() {
var time = new Date().getTime(),
name = 'reconnectRetryMaxDelay',
reconnecting = false;
var client = redis.createClient(PORT, HOST, {
retry_max_delay: 1
});
client.on('ready', function() {
if (!reconnecting) {
reconnecting = true;
client.retry_delay = 1000;
client.retry_backoff = 1;
client.stream.end();
} else {
client.end();
var lasted = new Date().getTime() - time;
assert.ok(lasted < 1000);
next(name);
}
});
};
all_tests = Object.keys(tests);
all_start = new Date();
test_count = 0;