You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-07 13:22:56 +03:00
Fix parser incorrect buffer skip for MULTI/EXEC transaction errors with WATCH.
Signed-off-by: DTrejo <david.daniel.trejo@gmail.com>
This commit is contained in:
@@ -117,7 +117,6 @@ ReplyParser.prototype._parseResult = function (type) {
|
||||
}
|
||||
|
||||
if (packetHeader.size < 0) {
|
||||
this._offset += 2;
|
||||
return null;
|
||||
}
|
||||
|
||||
|
35
test.js
35
test.js
@@ -454,6 +454,41 @@ tests.WATCH_MULTI = function () {
|
||||
multi.exec(last(name, require_null(name)));
|
||||
};
|
||||
|
||||
tests.WATCH_TRANSACTION = function () {
|
||||
var name = "WATCH_TRANSACTION";
|
||||
|
||||
if (!server_version_at_least(client, [2, 1, 0])) {
|
||||
console.log("Skipping " + name + " because server version isn't new enough.");
|
||||
return next(name);
|
||||
}
|
||||
|
||||
// Test WATCH command aborting transactions, look for parser offset errors.
|
||||
|
||||
client.set("unwatched", 200);
|
||||
|
||||
client.set(name, 0);
|
||||
client.watch(name);
|
||||
client.incr(name);
|
||||
var multi = client.multi()
|
||||
.incr(name)
|
||||
.exec(function (err, replies) {
|
||||
// Failure expected because of pre-multi incr
|
||||
assert.strictEqual(replies, null, "Aborted transaction multi-bulk reply should be null.");
|
||||
|
||||
client.get("unwatched", function (err, reply) {
|
||||
assert.equal(err, null, name);
|
||||
assert.equal(reply, 200, "Expected 200, got " + reply);
|
||||
next(name);
|
||||
});
|
||||
});
|
||||
|
||||
client.set("unrelated", 100, function (err, reply) {
|
||||
assert.equal(err, null, name);
|
||||
assert.equal(reply, "OK", "Expected 'OK', got " + reply);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
tests.detect_buffers = function () {
|
||||
var name = "detect_buffers", detect_client = redis.createClient(null, null, {detect_buffers: true});
|
||||
|
||||
|
Reference in New Issue
Block a user