Skip to content

Commit f726bf2

Browse files
committed
do not fire drain before any queries execute
1 parent e6fe115 commit f726bf2

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/native.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ p.query = function(config, values, callback) {
2525
return q;
2626
}
2727

28-
p._pulseQueryQueue = function() {
28+
p._pulseQueryQueue = function(initialConnection) {
2929
if(!this._connected) {
3030
return;
3131
}
@@ -34,7 +34,9 @@ p._pulseQueryQueue = function() {
3434
}
3535
var query = this._queryQueue.shift();
3636
if(!query) {
37-
this.emit('drain');
37+
if(!initialConnection) {
38+
this.emit('drain');
39+
}
3840
return;
3941
}
4042
this._activeQuery = query;
@@ -65,7 +67,7 @@ var ctor = function(config) {
6567
connection._config = utils.normalizeConnectionInfo(config);
6668
connection.on('connect', function() {
6769
connection._connected = true;
68-
connection._pulseQueryQueue();
70+
connection._pulseQueryQueue(true);
6971
});
7072

7173
//proxy some events to active query

0 commit comments

Comments
 (0)