code cleanup
This commit is contained in:
parent
26a85101ce
commit
0d19522339
@ -26,9 +26,6 @@ module.exports = {
|
|||||||
|
|
||||||
client.once('error', onError);
|
client.once('error', onError);
|
||||||
|
|
||||||
//TODO refactor
|
|
||||||
//i don't like reaching into the client's connection for attaching
|
|
||||||
//to specific events here
|
|
||||||
client.once('connect', onReady);
|
client.once('connect', onReady);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,15 +38,6 @@ module.exports = {
|
|||||||
return defaults.poolSize;
|
return defaults.poolSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
var log = function() {
|
|
||||||
//do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
//for testing
|
|
||||||
// var log = function() {
|
|
||||||
// console.log.apply(console, arguments);
|
|
||||||
// }
|
|
||||||
|
|
||||||
var getPooledClient = function(config, callback) {
|
var getPooledClient = function(config, callback) {
|
||||||
//lookup pool using config as key
|
//lookup pool using config as key
|
||||||
//TODO this don't work so hot w/ object configs
|
//TODO this don't work so hot w/ object configs
|
||||||
@ -57,9 +45,7 @@ module.exports = {
|
|||||||
|
|
||||||
//create pool if doesn't exist
|
//create pool if doesn't exist
|
||||||
if(!pool) {
|
if(!pool) {
|
||||||
//log("creating pool %s", config)
|
|
||||||
pool = clientPools[config] = new Pool(defaults.poolSize, function() {
|
pool = clientPools[config] = new Pool(defaults.poolSize, function() {
|
||||||
//log("creating new client in pool %s", config)
|
|
||||||
var client = new Client(config);
|
var client = new Client(config);
|
||||||
client.connected = false;
|
client.connected = false;
|
||||||
return client;
|
return client;
|
||||||
@ -67,7 +53,6 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pool.checkOut(function(err, client) {
|
pool.checkOut(function(err, client) {
|
||||||
|
|
||||||
//if client already connected just
|
//if client already connected just
|
||||||
//pass it along to the callback and return
|
//pass it along to the callback and return
|
||||||
if(client.connected) {
|
if(client.connected) {
|
||||||
@ -92,9 +77,6 @@ module.exports = {
|
|||||||
|
|
||||||
client.once('error', onError);
|
client.once('error', onError);
|
||||||
|
|
||||||
//TODO refactor
|
|
||||||
//i don't like reaching into the client's connection for attaching
|
|
||||||
//to specific events here
|
|
||||||
client.once('connect', onReady);
|
client.once('connect', onReady);
|
||||||
|
|
||||||
client.connect();
|
client.connect();
|
||||||
|
@ -11,6 +11,7 @@ module.exports = {
|
|||||||
defaults: defaults
|
defaults: defaults
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//lazy require native as it may not have been built
|
||||||
module.exports.__defineGetter__("native", function() {
|
module.exports.__defineGetter__("native", function() {
|
||||||
return require(__dirname + '/native');
|
return require(__dirname + '/native');
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user