You've already forked node-redis
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:
4
index.js
4
index.js
@@ -492,8 +492,8 @@ RedisClient.prototype.return_error = function (err) {
|
|||||||
var command_obj = this.command_queue.shift(), queue_len = this.command_queue.getLength();
|
var command_obj = this.command_queue.shift(), queue_len = this.command_queue.getLength();
|
||||||
|
|
||||||
if (this.pub_sub_mode === false && queue_len === 0) {
|
if (this.pub_sub_mode === false && queue_len === 0) {
|
||||||
this.emit("idle");
|
|
||||||
this.command_queue = new Queue();
|
this.command_queue = new Queue();
|
||||||
|
this.emit("idle");
|
||||||
}
|
}
|
||||||
if (this.should_buffer && queue_len <= this.command_queue_low_water) {
|
if (this.should_buffer && queue_len <= this.command_queue_low_water) {
|
||||||
this.emit("drain");
|
this.emit("drain");
|
||||||
@@ -571,8 +571,8 @@ RedisClient.prototype.return_reply = function (reply) {
|
|||||||
queue_len = this.command_queue.getLength();
|
queue_len = this.command_queue.getLength();
|
||||||
|
|
||||||
if (this.pub_sub_mode === false && queue_len === 0) {
|
if (this.pub_sub_mode === false && queue_len === 0) {
|
||||||
this.emit("idle");
|
|
||||||
this.command_queue = new Queue(); // explicitly reclaim storage from old Queue
|
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) {
|
if (this.should_buffer && queue_len <= this.command_queue_low_water) {
|
||||||
this.emit("drain");
|
this.emit("drain");
|
||||||
|
Reference in New Issue
Block a user