Browse Source

Fix for null MULTI response when WATCH condition fails.

gh-pages
Matt Ranney 14 years ago
parent
commit
05e9699817
  1. 1
      README.md
  2. 4
      changelog.md
  3. 5
      package.json
  4. 43
      test.js

1
README.md

@ -420,6 +420,7 @@ In order of first contribution, they are:
* [Orion Henry](http://github.com/orionz)
* [Hank Sims](http://github.com/hanksims)
* [Aivo Paas](http://github.com/aivopaas)
* [Paul Carey](https://github.com/paulcarey)
Thanks.

4
changelog.md

@ -1,6 +1,10 @@
Changelog
=========
## v0.3.8 - November 10, 2010
Fix for null MULTI response when WATCH condition fails.
## v0.3.7 - November 9, 2010
Add "drain" and "idle" events.

5
package.json

@ -1,5 +1,5 @@
{ "name" : "redis",
"version" : "0.3.7",
"version" : "0.3.8",
"description" : "Redis client library",
"author": "Matt Ranney <mjr@ranney.com>",
"contributors": [
@ -8,7 +8,8 @@
"TJ Holowaychuk",
"Orion Henry",
"Hank Sims",
"Aivo Paas"
"Aivo Paas",
"Paul Carey"
],
"main": "./index.js",
"scripts": {

43
test.js

@ -6,7 +6,10 @@ var redis = require("./index"),
assert = require("assert"),
util,
test_db_num = 15, // this DB will be flushed and used for testing
tests = {};
tests = {},
connected = false,
ended = false,
server_info;
try {
util = require("util");
@ -207,13 +210,18 @@ tests.MULTI_6 = function () {
tests.WATCH_MULTI = function () {
var name = 'WATCH_MULTI';
client.watch(name);
var multi = client.multi();
multi.incr(name);
client.incr(name);
multi.exec(function (err, replies) {
next(name);
});
if (server_info.versions[0] >= 2 && server_info.versions[1] >= 1) {
client.watch(name);
var multi = client.multi();
multi.incr(name);
client.incr(name);
multi.exec(function (err, replies) {
next(name);
});
} else {
console.log("Skipping " + name + " because server version isn't new enough.");
next(name);
}
};
tests.HSET = function () {
@ -991,11 +999,24 @@ function run_next_test() {
}
}
var connected = false;
var ended = false;
client.on("connect", function () {
// Fetch and stash info results in case anybody needs info on the server we are using.
client.info(function (err, reply) {
var obj = {};
reply.toString().split('\n').forEach(function (line) {
var parts = line.split(':');
if (parts[1]) {
obj[parts[0]] = parts[1];
}
});
obj.versions = [];
obj.redis_version.split('.').forEach(function (num) {
obj.versions.push(+num);
});
server_info = obj;
});
connected = true;
console.log();
run_next_test();
});

Loading…
Cancel
Save