From 2224767c4cf725ddcd2546984565e97537824c06 Mon Sep 17 00:00:00 2001 From: Trae Robrock Date: Thu, 28 Jun 2012 17:13:40 -0700 Subject: [PATCH] Moving some logic that should fix the idle event Signed-off-by: DTrejo --- index.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 45b4c7ed02..76fb2640f6 100644 --- a/index.js +++ b/index.js @@ -525,8 +525,9 @@ function reply_to_strings(reply) { RedisClient.prototype.return_reply = function (reply) { var command_obj, obj, i, len, type, timestamp, argindex, args, queue_len; - - queue_len = this.command_queue.getLength(); + + command_obj = this.command_queue.shift() + queue_len = this.command_queue.getLength(); if (this.pub_sub_mode === false && queue_len === 0) { this.emit("idle"); @@ -537,8 +538,6 @@ RedisClient.prototype.return_reply = function (reply) { this.should_buffer = false; } - command_obj = this.command_queue.shift(); - if (command_obj && !command_obj.sub_command) { if (typeof command_obj.callback === "function") { if (this.options.detect_buffers && command_obj.buffer_args === false) {