Permalink
Browse files

Fixed bm.js

  • Loading branch information...
1 parent e508978 commit 27467ba3487f47d61ee3e74c18e4620b89fdcf04 @tj committed Sep 17, 2010
Showing with 8 additions and 5 deletions.
  1. +8 −5 bm.js
View
13 bm.js
@@ -7,11 +7,14 @@ var n = times
, client = redis.createClient()
, start = new Date;
-while (n--) {
- client.set('foo:' + n, 'bar', function(){
- --pending || report();
- });
-}
+client.on('connect', function(){
+ while (n--) {
+ client.set('foo:' + n, 'bar', function(err){
+ if (err) throw err;
+ --pending || report();
+ });
+ }
+});
function report() {
console.log('\x1b[33m%d\x1b[0m sets in \x1b[32m%d\x1b[0m milliseconds', times, new Date - start);

0 comments on commit 27467ba

Please sign in to comment.