You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-07 13:22:56 +03:00
Add unref() method to RedisClient that will call unref() on the socket connection, allowing it to close when unused. This is experimental because it does not yet understand the Redis protocol, so subscriptions or blocking operations will not work correctly.
This commit is contained in:
18
test.js
18
test.js
@@ -10,6 +10,7 @@ var redis = require("./index"),
|
||||
assert = require("assert"),
|
||||
crypto = require("crypto"),
|
||||
util = require("./lib/util"),
|
||||
fork = require("child_process").fork,
|
||||
test_db_num = 15, // this DB will be flushed and used for testing
|
||||
tests = {},
|
||||
connected = false,
|
||||
@@ -2013,6 +2014,23 @@ tests.reconnectRetryMaxDelay = function() {
|
||||
});
|
||||
};
|
||||
|
||||
tests.unref = function () {
|
||||
var name = "unref";
|
||||
var external = fork("./test-unref.js");
|
||||
var done = false;
|
||||
external.on("close", function (code) {
|
||||
assert(code == 0, "test-unref.js failed");
|
||||
done = true;
|
||||
})
|
||||
setTimeout(function () {
|
||||
if (!done) {
|
||||
external.kill();
|
||||
}
|
||||
assert(done, "test-unref.js didn't finish in time.");
|
||||
next(name);
|
||||
}, 100);
|
||||
};
|
||||
|
||||
all_tests = Object.keys(tests);
|
||||
all_start = new Date();
|
||||
test_count = 0;
|
||||
|
Reference in New Issue
Block a user