Skip to content

Commit cb4e356

Browse files
committed
bind domain only for async flow
1 parent 36db834 commit cb4e356

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lib/Pool.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ function Pool(options) {
2020

2121
Pool.prototype.getConnection = function (cb) {
2222

23-
if (cb && process.domain)
24-
cb = process.domain.bind(cb);
25-
2623
if (this._closed) {
2724
return process.nextTick(function(){
2825
return cb(new Error('Pool is closed.'));
@@ -67,6 +64,8 @@ Pool.prototype.getConnection = function (cb) {
6764
return cb(new Error('Queue limit reached.'));
6865
}
6966

67+
if (cb && process.domain)
68+
cb = process.domain.bind(cb);
7069
this._connectionQueue.push(cb);
7170
};
7271

0 commit comments

Comments
 (0)