diff --git a/lib/redis.js b/lib/redis.js index bf043c0f..47be4c8e 100644 --- a/lib/redis.js +++ b/lib/redis.js @@ -564,7 +564,7 @@ Redis.prototype.sendCommand = function (command, stream) { } var writable = (this.status === 'ready') || - ((this.status === 'connect') && commands.hasFlag(command.name, 'loading')); + (!stream && (this.status === 'connect') && commands.hasFlag(command.name, 'loading')); if (!this.stream) { writable = false; } else if (!this.stream.writable) { diff --git a/test/functional/pipeline.js b/test/functional/pipeline.js index fdd0b412..c75d87c3 100644 --- a/test/functional/pipeline.js +++ b/test/functional/pipeline.js @@ -191,5 +191,20 @@ describe('pipeline', function () { done(); }); }); + + it('should batch all commands before ready event', function (done) { + var redis = new Redis(); + redis.on('connect', function () { + redis.pipeline().info().config('get', 'maxmemory').exec(function (err, res) { + expect(err).to.eql(null); + expect(res).to.have.lengthOf(2); + expect(res[0][0]).to.eql(null); + expect(typeof res[0][1]).to.eql('string'); + expect(res[1][0]).to.eql(null); + expect(Array.isArray(res[1][1])).to.eql(true); + done(); + }); + }); + }); }); }); diff --git a/test/functional/transaction.js b/test/functional/transaction.js index 23e1910f..651d8475 100644 --- a/test/functional/transaction.js +++ b/test/functional/transaction.js @@ -144,4 +144,21 @@ describe('transaction', function () { }); }); }); + + describe('#exec', function () { + it('should batch all commands before ready event', function (done) { + var redis = new Redis(); + redis.on('connect', function () { + redis.multi().info().config('get', 'maxmemory').exec(function (err, res) { + expect(err).to.eql(null); + expect(res).to.have.lengthOf(2); + expect(res[0][0]).to.eql(null); + expect(typeof res[0][1]).to.eql('string'); + expect(res[1][0]).to.eql(null); + expect(Array.isArray(res[1][1])).to.eql(true); + done(); + }); + }); + }); + }); });