Skip to content

Commit

Permalink
feat: add debug details for connection pool
Browse files Browse the repository at this point in the history
  • Loading branch information
luin committed Jun 22, 2018
1 parent 1fdd46c commit 9ec16b6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/cluster/connection_pool.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ var utils = require('../utils');
var EventEmitter = require('events').EventEmitter;
var _ = require('../utils/lodash');
var Redis = require('../redis');
var debug = require('../utils/debug')('ioredis:cluster:connectionPool');

function ConnectionPool(redisOptions) {
EventEmitter.call(this);
Expand Down Expand Up @@ -115,11 +116,14 @@ ConnectionPool.prototype.reset = function (nodes) {
var _this = this;
Object.keys(this.nodes.all).forEach(function (key) {
if (!newNodes[key]) {
debug('Disconnect %s because the node does not hold any slot', key);
_this.nodes.all[key].disconnect();
}
});
Object.keys(newNodes).forEach(function (key) {
_this.findOrCreate(newNodes[key], newNodes[key].readOnly);
var node = newNodes[key];
debug('Connecting to %s as %s', key, node.readOnly ? 'slave' : 'master');
_this.findOrCreate(node, node.readOnly);
});
};

Expand Down

0 comments on commit 9ec16b6

Please sign in to comment.