1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-06 02:15:48 +03:00

Fixed a subtle error where commands issued within the idle event handler

This commit is contained in:
roam
2013-03-18 16:27:55 +08:00
parent 6fb7204ca5
commit 290de97e18

View File

@@ -492,8 +492,8 @@ RedisClient.prototype.return_error = function (err) {
var command_obj = this.command_queue.shift(), queue_len = this.command_queue.getLength();
if (this.pub_sub_mode === false && queue_len === 0) {
this.emit("idle");
this.command_queue = new Queue();
this.emit("idle");
}
if (this.should_buffer && queue_len <= this.command_queue_low_water) {
this.emit("drain");
@@ -571,8 +571,8 @@ RedisClient.prototype.return_reply = function (reply) {
queue_len = this.command_queue.getLength();
if (this.pub_sub_mode === false && queue_len === 0) {
this.emit("idle");
this.command_queue = new Queue(); // explicitly reclaim storage from old Queue
this.emit("idle");
}
if (this.should_buffer && queue_len <= this.command_queue_low_water) {
this.emit("drain");