refactor: use batch for multiple insertions

This commit is contained in:
José Oliveira 2021-04-19 16:22:32 +01:00 committed by Josh Harvey
parent 4bf972b995
commit 3846d7f9d7

View file

@ -512,7 +512,7 @@ function plugins (settings, deviceId) {
}
function recordTradeAndTx (tradeId, internalTxIdList, dbTx) {
_.map(internalTxId => {
dbTx.batch(_.map(internalTxId => {
let entry = { trade_id: tradeId }
if (internalTxId.direction === 'cashIn') {
entry.cash_in_tx_id = internalTxId.txId
@ -521,6 +521,7 @@ function plugins (settings, deviceId) {
entry.cash_out_tx_id = internalTxId.txId
return dbTx.none(pgp.helpers.insert(entry, null, 'cashout_tx_trades'))
}, internalTxIdList)
)
}
function convertBigNumFields (obj) {