Skip to content

Commit 2a64b80

Browse files
zbarbutojannyHou
authored andcommitted
Wrap transaction error callbacks in nextTick
1 parent 078bb6f commit 2a64b80

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/postgresql.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,14 @@ PostgreSQL.prototype.executeSQL = function(sql, params, options, callback) {
163163
var transaction = options.transaction;
164164
if (transaction && transaction.connector === this) {
165165
if (!transaction.connection) {
166-
return callback(new Error(g.f('Connection does not exist')));
166+
return process.nextTick(function() {
167+
callback(new Error(g.f('Connection does not exist')))
168+
});
167169
}
168170
if (transaction.txId !== transaction.connection.txId) {
169-
return callback(new Error(g.f('Transaction is not active')));
171+
return process.nextTick(function() {
172+
callback(new Error(g.f('Transaction is not active')))
173+
});
170174
}
171175
debug('Execute SQL within a transaction');
172176
// Do not release the connection

0 commit comments

Comments
 (0)