You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
Fix individual createClient functions passing undefined options to a new instance. Closes #893
This commit is contained in:
@@ -1,6 +1,12 @@
|
|||||||
Changelog
|
Changelog
|
||||||
=========
|
=========
|
||||||
|
|
||||||
|
## v.2.2.5 - 18 Oct, 2015
|
||||||
|
|
||||||
|
Bugfixes
|
||||||
|
|
||||||
|
- Fixed undefined options passed to a new instance not accepted (possible with individual .createClient functions) ([@BridgeAR](https://github.com/BridgeAR))
|
||||||
|
|
||||||
## v.2.2.4 - 17 Oct, 2015
|
## v.2.2.4 - 17 Oct, 2015
|
||||||
|
|
||||||
Bugfixes
|
Bugfixes
|
||||||
|
2
index.js
2
index.js
@@ -36,7 +36,7 @@ parsers.push(require('./lib/parsers/javascript'));
|
|||||||
|
|
||||||
function RedisClient(stream, options) {
|
function RedisClient(stream, options) {
|
||||||
// Copy the options so they are not mutated
|
// Copy the options so they are not mutated
|
||||||
options = JSON.parse(JSON.stringify(options));
|
options = JSON.parse(JSON.stringify(options || {}));
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
if (!stream.cork) {
|
if (!stream.cork) {
|
||||||
|
@@ -4,6 +4,7 @@ var assert = require("assert");
|
|||||||
var config = require("./lib/config");
|
var config = require("./lib/config");
|
||||||
var helper = require('./helper');
|
var helper = require('./helper');
|
||||||
var redis = config.redis;
|
var redis = config.redis;
|
||||||
|
var net = require('net');
|
||||||
|
|
||||||
describe("connection tests", function () {
|
describe("connection tests", function () {
|
||||||
helper.allTests(function(parser, ip, args) {
|
helper.allTests(function(parser, ip, args) {
|
||||||
@@ -186,27 +187,16 @@ describe("connection tests", function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("buffer commands and flush them after ", function (done) {
|
it("works with missing options object for new redis instances", function () {
|
||||||
client = redis.createClient(9999, null, {
|
// This is needed for libraries that have their own createClient function like fakeredis
|
||||||
parser: parser
|
var cnxOptions = {
|
||||||
});
|
port : 6379,
|
||||||
|
host : '127.0.0.1',
|
||||||
client.on('error', function(e) {
|
family : ip === 'IPv6' ? 6 : 4
|
||||||
// ignore, b/c expecting a "can't connect" error
|
};
|
||||||
});
|
var net_client = net.createConnection(cnxOptions);
|
||||||
|
client = new redis.RedisClient(net_client);
|
||||||
return setTimeout(function() {
|
});
|
||||||
client.set('foo', 'bar', function(err, result) {
|
|
||||||
// This should never be called
|
|
||||||
return done(err);
|
|
||||||
});
|
|
||||||
|
|
||||||
return setTimeout(function() {
|
|
||||||
assert.strictEqual(client.offline_queue.length, 1);
|
|
||||||
return done();
|
|
||||||
}, 25);
|
|
||||||
}, 50);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("throws on strange connection info", function () {
|
it("throws on strange connection info", function () {
|
||||||
try {
|
try {
|
||||||
|
Reference in New Issue
Block a user