Permalink
Browse files

0.1.6 - Update node-redis

  • Loading branch information...
1 parent a7a0301 commit 63df30478420e51c515f1bc4e7449fa8fadd883a @tim-smart tim-smart committed Mar 7, 2011
Showing with 14 additions and 15 deletions.
  1. +4 −4 deps/node-redis/bench.js
  2. +4 −4 deps/node-redis/index.js
  3. +1 −1 deps/node-redis/package.json
  4. +4 −4 deps/node-redis/test/main.js
  5. +1 −2 package.json
View
@@ -1,11 +1,11 @@
var redis = require('./'),
- redis2 = require('redis'),
+ //redis2 = require('redis'),
//redis3 = require('./bench/redis-node/redis'),
//redis4 = require('./bench/redis-client'),
Seq = require('parallel').Sequence,
assert = require('assert');
-var clients = { 'node-redis': redis.createClient(), 'node_redis': redis2.createClient(),
+var clients = { 'node-redis': redis.createClient(), /*'node_redis': redis2.createClient(),*/
/*'redis-node': redis3.createClient(), 'redis-node-client': redis4.createClient()*/ }
var iterations = 5000,
@@ -44,9 +44,9 @@ var benches = {
},
lrange: function (client, callback) {
for (var i = 0; i < iterations - 1; i++) {
- client.lrange('bench', 0, 99);
+ client.lrange('bench', 0, 10);
}
- client.lrange('bench', 0, 99, callback);
+ client.lrange('bench', 0, 10, callback);
},
hmset: function (client, callback) {
if ('redis-node' === client._name) return callback();
View
@@ -74,7 +74,7 @@ var RedisClient = function RedisClient(port, host, auth) {
}
for (var i = 0, il = self.send_buffer.length; i < il; i++) {
- if (false === self.stream.write(self.send_buffer[i])) {
+ if (!self.stream.writable || false === self.stream.write(self.send_buffer[i])) {
return self.send_buffer = self.send_buffer.slice(i + 1);
}
}
@@ -108,14 +108,14 @@ var RedisClient = function RedisClient(port, host, auth) {
this.parser.on('reply', function (reply) {
var command = self.commands.shift();
- if (command[2]) command[2](null, reply);
+ if (command && command[2]) command[2](null, reply);
});
// DB error
this.parser.on('error', function (error) {
var command = self.commands.shift();
error = new Error(error);
- if (command[2]) command[2](error);
+ if (command && command[2]) command[2](error);
else self.emit('error', error);
});
@@ -211,7 +211,7 @@ RedisClient.prototype.sendCommand = function (command, args, callback) {
if ('string' === arg_type) {
// We can send this in one go.
- previous += '$' + arg.length + '\r\n' + arg + '\r\n';
+ previous += '$' + Buffer.byteLength(arg) + '\r\n' + arg + '\r\n';
} else if ('number' === arg_type) {
// We can send this in one go.
previous += '$' + ('' + arg).length + '\r\n' + arg + '\r\n';
@@ -1,7 +1,7 @@
{
"name": "node-redis",
"description": "Lightweight, fast, Redis client.",
- "version": "0.1.0",
+ "version": "0.1.1",
"author": "Tim Smart",
"contributors": [
"Matt Ranney"
@@ -30,23 +30,23 @@ module.exports = {
var n = 0,
o = 0;
- for (var i = 0; i < 10000; i++) {
+ for (var i = 0; i < 100000; i++) {
c.set('2' + i, buffer, function (error) {
assert.ok(!error);
++n;
});
}
- for (i = 0; i < 10000; i++) {
+ for (i = 0; i < 100000; i++) {
c.del('2' + i, function (error) {
assert.ok(!error);
++o;
});
}
beforeExit(function () {
- assert.equal(n, 10000);
- assert.equal(o, 10000);
+ assert.equal(n, 100000);
+ assert.equal(o, 100000);
});
},
after: function () {
View
@@ -1,9 +1,8 @@
{
"name": "rqueue",
"description": "A node.js implementation of RQueue, includes Worker and Queue ",
- "version": "0.1.5",
+ "version": "0.1.6",
"author": "Tim Smart <tim@votizen.com>",
- "contributors": ["Micheil Smith <micheil@votizen.com>"],
"engine": [ "node >=0.3.6" ],
"main": "./",
"dependencies": {

0 comments on commit 63df304

Please sign in to comment.