Skip to content

Commit

Permalink
Fixed a subtle error where commands issued within the idle event handler
Browse files Browse the repository at this point in the history
  • Loading branch information
roamm committed Mar 18, 2013
1 parent 6fb7204 commit 290de97
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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");
Expand Down

0 comments on commit 290de97

Please sign in to comment.