You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-04 15:02:09 +03:00
Merge branch 'select_db_exception' of https://github.com/roamm/node_redis into roamm-select_db_exception
This commit is contained in:
9
index.js
9
index.js
@@ -285,7 +285,12 @@ RedisClient.prototype.on_ready = function () {
|
||||
|
||||
// magically restore any modal commands from a previous connection
|
||||
if (this.selected_db !== null) {
|
||||
// this trick works if and only if the following send_command
|
||||
// never goes into the offline queue
|
||||
var pub_sub_mode = this.pub_sub_mode;
|
||||
this.pub_sub_mode = false;
|
||||
this.send_command('select', [this.selected_db]);
|
||||
this.pub_sub_mode = pub_sub_mode;
|
||||
}
|
||||
if (this.pub_sub_mode === true) {
|
||||
// only emit "ready" when all subscriptions were made again
|
||||
@@ -494,8 +499,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");
|
||||
@@ -585,8 +590,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");
|
||||
|
Reference in New Issue
Block a user