node-resque
Advanced tools
Comparing version 0.8.0 to 0.8.1
@@ -16,3 +16,3 @@ var connection = function(options){ | ||
self.connected = true; | ||
options.redis.get('test_key', function(err){ | ||
options.redis.get('key', function(err, data){ | ||
if(err){ self.connected = false; } | ||
@@ -58,30 +58,34 @@ }) | ||
self.redis.on('error', function(err){ | ||
if(self.connected === false){ | ||
callback(err); | ||
} | ||
// catch to prevent bubble up of error | ||
}); | ||
self.redis.on('connect', function(){ | ||
if(options.database != null){ self.redis.select(options.database); } | ||
self.connected = true; | ||
if(options.password != null && options.password != "" && self.options.fake != true){ | ||
self.redis.auth(options.password, function(err){ | ||
self.redis.select(options.database, function(err){ | ||
callback(err); | ||
}); | ||
}); | ||
}else if(self.options.package != 'fakeredis'){ | ||
self.redis.select(options.database, function(err){ | ||
self.redis.info(function(err, data){ | ||
callback(err); | ||
}); | ||
}); | ||
} | ||
}); | ||
self.redis.on('end', function(){ | ||
self.connected = false; | ||
}); | ||
if(options.password != null && options.password != "" && self.options.fake != true){ | ||
self.redis.auth(options.password, function(err){ | ||
self.redis.select(options.database, function(err){ | ||
callback(err); | ||
}); | ||
}); | ||
}else if(self.options.package != 'fakeredis'){ | ||
self.redis.select(options.database, function(err){ | ||
self.redis.info(function(err, data){ | ||
callback(err); | ||
}); | ||
}); | ||
}else{ | ||
// fakeredis cannot use the 'info' command; but you can assume you are connected | ||
if(self.options.package === 'fakeredis' || self.options.redis != null){ | ||
if(options.database != null){ self.redis.select(options.database); } | ||
process.nextTick(function(){ | ||
callback(); | ||
}) | ||
}); | ||
} | ||
@@ -88,0 +92,0 @@ } |
@@ -5,3 +5,3 @@ { | ||
"description": "an opinionated implementation of resque in node", | ||
"version": "0.8.0", | ||
"version": "0.8.1", | ||
"homepage": "http://github.com/taskrabbit/node-resque", | ||
@@ -8,0 +8,0 @@ "repository": { |
99718
2272