do not fire drain before any queries execute

This commit is contained in:
brianc 2011-08-15 20:31:31 -05:00
parent e6fe115962
commit f726bf29ef

View File

@ -25,7 +25,7 @@ p.query = function(config, values, callback) {
return q;
}
p._pulseQueryQueue = function() {
p._pulseQueryQueue = function(initialConnection) {
if(!this._connected) {
return;
}
@ -34,7 +34,9 @@ p._pulseQueryQueue = function() {
}
var query = this._queryQueue.shift();
if(!query) {
this.emit('drain');
if(!initialConnection) {
this.emit('drain');
}
return;
}
this._activeQuery = query;
@ -65,7 +67,7 @@ var ctor = function(config) {
connection._config = utils.normalizeConnectionInfo(config);
connection.on('connect', function() {
connection._connected = true;
connection._pulseQueryQueue();
connection._pulseQueryQueue(true);
});
//proxy some events to active query