You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
Fix excess memory consumption from Queue backing store.
Thanks to Gustaf Sjöberg.
This commit is contained in:
12
changelog.md
12
changelog.md
@@ -1,6 +1,18 @@
|
||||
Changelog
|
||||
=========
|
||||
|
||||
## v0.5.4 - February 11, 2011
|
||||
|
||||
Fix excess memory consumption from Queue backing store.
|
||||
|
||||
Thanks to Gustaf Sjöberg.
|
||||
|
||||
## v0.5.3 - February 5, 2011
|
||||
|
||||
Fix multi/exec error reply callback logic.
|
||||
|
||||
Thanks to Stella Laurenzo.
|
||||
|
||||
## v0.5.2 - January 18, 2011
|
||||
|
||||
Fix bug where unhandled error replies confuse the parser.
|
||||
|
13
index.js
13
index.js
@@ -112,6 +112,8 @@ function RedisClient(stream, options) {
|
||||
}
|
||||
self.send_command(command_obj.command, command_obj.args, command_obj.callback);
|
||||
}
|
||||
self.offline_queue = new Queue();
|
||||
// Even though items were shifted off, Queue backing store still uses memory until next add
|
||||
});
|
||||
|
||||
this.stream.on("data", function (buffer_from_socket) {
|
||||
@@ -133,6 +135,14 @@ function RedisClient(stream, options) {
|
||||
args[2](message);
|
||||
}
|
||||
});
|
||||
self.offline_queue = new Queue();
|
||||
|
||||
self.command_queue.forEach(function (args) {
|
||||
if (typeof args[2] === "function") {
|
||||
args[2](message);
|
||||
}
|
||||
});
|
||||
self.command_queue = new Queue();
|
||||
|
||||
self.connected = false;
|
||||
self.emit("error", new Error(message));
|
||||
@@ -183,6 +193,7 @@ RedisClient.prototype.connection_gone = function (why) {
|
||||
args[2]("Server connection closed");
|
||||
}
|
||||
});
|
||||
self.command_queue = new Queue();
|
||||
|
||||
// If this is a requested shutdown, then don't retry
|
||||
if (self.closing) {
|
||||
@@ -229,6 +240,7 @@ RedisClient.prototype.return_error = function (err) {
|
||||
|
||||
if (this.subscriptions === false && this.command_queue.length === 0) {
|
||||
this.emit("idle");
|
||||
this.command_queue = new Queue();
|
||||
}
|
||||
|
||||
if (command_obj && typeof command_obj.callback === "function") {
|
||||
@@ -255,6 +267,7 @@ RedisClient.prototype.return_reply = function (reply) {
|
||||
|
||||
if (this.subscriptions === false && this.command_queue.length === 0) {
|
||||
this.emit("idle");
|
||||
this.command_queue = new Queue();
|
||||
}
|
||||
|
||||
if (command_obj && !command_obj.sub_command) {
|
||||
|
@@ -1,5 +1,5 @@
|
||||
{ "name" : "redis",
|
||||
"version" : "0.5.3",
|
||||
"version" : "0.5.4",
|
||||
"description" : "Redis client library",
|
||||
"author": "Matt Ranney <mjr@ranney.com>",
|
||||
"contributors": [
|
||||
|
Reference in New Issue
Block a user