refactor: use batch for multiple insertions
This commit is contained in:
parent
4bf972b995
commit
3846d7f9d7
1 changed files with 2 additions and 1 deletions
|
|
@ -512,7 +512,7 @@ function plugins (settings, deviceId) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function recordTradeAndTx (tradeId, internalTxIdList, dbTx) {
|
function recordTradeAndTx (tradeId, internalTxIdList, dbTx) {
|
||||||
_.map(internalTxId => {
|
dbTx.batch(_.map(internalTxId => {
|
||||||
let entry = { trade_id: tradeId }
|
let entry = { trade_id: tradeId }
|
||||||
if (internalTxId.direction === 'cashIn') {
|
if (internalTxId.direction === 'cashIn') {
|
||||||
entry.cash_in_tx_id = internalTxId.txId
|
entry.cash_in_tx_id = internalTxId.txId
|
||||||
|
|
@ -521,6 +521,7 @@ function plugins (settings, deviceId) {
|
||||||
entry.cash_out_tx_id = internalTxId.txId
|
entry.cash_out_tx_id = internalTxId.txId
|
||||||
return dbTx.none(pgp.helpers.insert(entry, null, 'cashout_tx_trades'))
|
return dbTx.none(pgp.helpers.insert(entry, null, 'cashout_tx_trades'))
|
||||||
}, internalTxIdList)
|
}, internalTxIdList)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function convertBigNumFields (obj) {
|
function convertBigNumFields (obj) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue