You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +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:
14
index.js
14
index.js
@@ -121,6 +121,20 @@ RedisClient.prototype.initialize_retry_vars = function () {
|
||||
this.attempts = 1;
|
||||
};
|
||||
|
||||
RedisClient.prototype.unref = function () {
|
||||
trace("User requesting to unref the connection");
|
||||
if (this.connected) {
|
||||
trace("unref'ing the socket connection");
|
||||
this.stream.unref();
|
||||
}
|
||||
else {
|
||||
trace("Not connected yet, will unref later");
|
||||
this.once("connect", function () {
|
||||
this.unref();
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
// flush offline_queue and command_queue, erroring any items with a callback first
|
||||
RedisClient.prototype.flush_and_error = function (message) {
|
||||
var command_obj;
|
||||
|
Reference in New Issue
Block a user