Allow new transaction method in postgresql (#1493)

kv-extreme-scale needs fixing, unrelated.
This commit is contained in:
zbarbuto 2017-12-13 02:26:42 +10:30 committed by Kevin Delisle
parent 6bd9fca080
commit f5de99b249
1 changed files with 5 additions and 0 deletions

View File

@ -2229,6 +2229,11 @@ DataSource.prototype.transaction = function(execute, options, cb) {
// retrieved again in determineOptions() in dao.js, as well as referenced // retrieved again in determineOptions() in dao.js, as well as referenced
// in transaction.commit() and transaction.rollback() below. // in transaction.commit() and transaction.rollback() below.
transaction.currentTransaction = tx; transaction.currentTransaction = tx;
// Some connectors like Postgresql expose loobpack-connector as a property on the tx
if (!tx.observe && tx.connector) {
tx = tx.connector;
}
// Handle timeout and pass it on as an error. // Handle timeout and pass it on as an error.
tx.observe('timeout', function(context, next) { tx.observe('timeout', function(context, next) {
const err = new Error(g.f('Transaction is rolled back due to timeout')); const err = new Error(g.f('Transaction is rolled back due to timeout'));