Skip to content

Commit

Permalink
update connection logic to work with fakeredis not throwing a "connec…
Browse files Browse the repository at this point in the history
…" event
  • Loading branch information
evantahler committed Sep 13, 2015
1 parent 5c97074 commit 56f03a3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions lib/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ connection.prototype.connect = function(callback){
var package = require(self.options.package);
self.redis = package.createClient(self.options.port, self.options.host, self.options.options);

self.redis.on('connect', function(){
var handleConnection = function(){
if(self.options.password && self.options.password !== ''){
self.redis.auth(self.options.password);
}
Expand All @@ -69,7 +69,10 @@ connection.prototype.connect = function(callback){
}
});
}
});
};

self.redis.on('connect', handleConnection);
if(self.options.package === 'fakeredis'){ process.nextTick(handleConnection); }
}

self.redis.on('error', function(err){
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "node-resque",
"description": "an opinionated implementation of resque in node",
"license": "Apache-2.0",
"version": "1.0.0",
"version": "1.0.1",
"homepage": "http://github.com/taskrabbit/node-resque",
"repository": {
"type": "git",
Expand Down

0 comments on commit 56f03a3

Please sign in to comment.