RedisClient might enter pub/sub mode after at least one SELECT command issued.
When reconnecting, the SELECT command is issued after restoring pub_sub_command to true, which causes an exception.
An uncaught exception will be raised when the retry timer tries to
reconnect and encounter an error, for all event listeners of the stream
were removed in line 826. It should set closing varable to be true.
Also adds a test that uses SADD in caps. Nicely enough, this makes
multi_bench.js run just a tiny bit faster :)
Signed-off-by: DTrejo <david.trejo@voxer.com>
This change stores the connection state regarding subscriptions,
selected db and monitoring. When the connection to Redis drops, the state
is reestablished after a succesful reconnect. Fixes#241. Fixes#210.
Signed-off-by: DTrejo <david.trejo@voxer.com>
This is achieved by introducing a new option to the createClient method called bufferedInput.
If bufferedInput is set to true, then the returned data will be a Buffer if the command argument passed is a buffer
E.g.
var redis = require("redis"),
client = redis.createClient(<port>, <host>, {buffered_input: true});
client.set("foo_rand000000000000", "OK");
// The below get request will return a utf8 string
client.get("foo_rand000000000000", function (err, reply) {
console.log(reply.toString()); // Will print `OK`
});
// The below get request will return a Buffer as the key is specified as a Buffer
client.get(new Buffer("foo_rand000000000000"), function (err, reply) {
console.log(reply.toString()); // Will print `<Buffer 4f 4b>`
});
client.end();
Re-initialize the reply parser for every new connection. If a connection is terminated,
the parser could be left in a bad state. After the auto-reconnect magic kicks in, it
tries to reuse the old parser, which will not work.
This change is visible to client programs if you depend on client.reply_parser.name being
set immediately. It will now only be set after a connection is established.
Thanks to @jhurliman for reporting and @pietern for the fix suggestion.
Passing an Array as as the last argument should expand as users
expect. The old behavior was to coerce the arguments into Strings,
which did surprising things with Arrays.