Fix: fix rare concurrency bug on cashOut
This commit is contained in:
parent
d53b8460bd
commit
346d539960
1 changed files with 2 additions and 1 deletions
|
|
@ -19,7 +19,8 @@ function atomic (tx, pi, fromClient) {
|
|||
const isolationLevel = pgp.txMode.isolationLevel
|
||||
const mode = new TransactionMode({ tiLevel: isolationLevel.serializable })
|
||||
function transaction (t) {
|
||||
const sql = 'select * from cash_out_txs where id=$1'
|
||||
const sql = 'SELECT * FROM cash_out_txs WHERE id=$1 FOR UPDATE'
|
||||
|
||||
return t.oneOrNone(sql, [tx.id])
|
||||
.then(toObj)
|
||||
.then(oldTx => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue