chore: server code formatting

This commit is contained in:
Rafael Taranto 2025-05-12 15:35:00 +01:00
parent aedabcbdee
commit 68517170e2
234 changed files with 9824 additions and 6195 deletions

View file

@ -3,28 +3,28 @@ const _ = require('lodash/fp')
const txBatching = require('./tx-batching')
const wallet = require('./wallet')
function submitBatch (settings, batch) {
txBatching.getBatchTransactions(batch)
.then(txs => {
if (_.isEmpty(txs)) return Promise.resolve()
return wallet.sendCoinsBatch(settings, txs, batch.crypto_code)
.then(res => txBatching.confirmSentBatch(batch, res))
.catch(err => txBatching.setErroredBatch(batch, err.message))
})
function submitBatch(settings, batch) {
txBatching.getBatchTransactions(batch).then(txs => {
if (_.isEmpty(txs)) return Promise.resolve()
return wallet
.sendCoinsBatch(settings, txs, batch.crypto_code)
.then(res => txBatching.confirmSentBatch(batch, res))
.catch(err => txBatching.setErroredBatch(batch, err.message))
})
}
function processBatches (settings, lifecycle) {
return txBatching.getBatchesByStatus(['open'])
.then(batches => {
_.each(batch => {
const elapsedMS = batch.time_elapsed * 1000
function processBatches(settings, lifecycle) {
return txBatching.getBatchesByStatus(['open']).then(batches => {
_.each(batch => {
const elapsedMS = batch.time_elapsed * 1000
if (elapsedMS >= lifecycle) {
return txBatching.closeTransactionBatch(batch)
.then(() => submitBatch(settings, batch))
}
}, batches)
})
if (elapsedMS >= lifecycle) {
return txBatching
.closeTransactionBatch(batch)
.then(() => submitBatch(settings, batch))
}
}, batches)
})
}
module.exports = processBatches