Feat: upgrade pg-promise and fix breaking changes

This commit is contained in:
csrapr 2021-02-26 18:41:53 +00:00 committed by Josh Harvey
parent c4ea21259a
commit 8cd1389de3
7 changed files with 79 additions and 83 deletions

View file

@ -19,7 +19,11 @@ const MAX_PENDING = 10
module.exports = { post, monitorPending, cancel, PENDING_INTERVAL }
function post (machineTx, pi) {
return db.tx(cashInAtomic.atomic(machineTx, pi))
const TransactionMode = pgp.txMode.TransactionMode
const isolationLevel = pgp.txMode.isolationLevel
const mode = new TransactionMode({ tiLevel: isolationLevel.serializable })
return db.tx({ mode }, cashInAtomic.atomic(machineTx, pi))
.then(r => {
const updatedTx = r.tx
let blacklisted = false