Skip to content

Commit

Permalink
Merge pull request #135 from luin/fix/cluster-sendcommand
Browse files Browse the repository at this point in the history
Fix errors when sending command to a failed cluster. Close #56
  • Loading branch information
luin committed Aug 23, 2015
2 parents f8c35cf + ce190b0 commit 749aea4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/cluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -370,8 +370,8 @@ Cluster.prototype.sendCommand = function (command, stream, node) {
command.reject(new Error('Cluster is ended.'));
return;
}
var redis;
if (_this.status === 'ready') {
var redis;
if (node && node.redis) {
redis = node.redis;
} else if (_.includes(Command.FLAGS.ENTER_SUBSCRIBER_MODE, command.name) ||
Expand All @@ -396,6 +396,8 @@ Cluster.prototype.sendCommand = function (command, stream, node) {
if (node && !node.redis) {
node.redis = redis;
}
}
if (redis) {
redis.sendCommand(command, stream);
} else if (_this.options.enableOfflineQueue) {
_this.offlineQueue.push({
Expand Down

0 comments on commit 749aea4

Please sign in to comment.