chore: merge release-8.1 into telnyx (#1572)

* fix: concurrency issues caused by poller

* chore: version 8.1.4 (#1561)

* Revert "chore: version 8.1.4 (#1561)" (#1562)

This reverts commit eaa3dc5720.

---------

Co-authored-by: Taranto <rafael.taranto@protonmail.com>
This commit is contained in:
CrypticaScriptura 2023-07-31 17:49:27 -04:00 committed by GitHub
parent e8a3d2ed11
commit becd3e7a82
7 changed files with 48 additions and 26 deletions

View file

@ -27,6 +27,12 @@ function atomic (tx, pi, fromClient) {
const isStale = fromClient && oldTx && (oldTx.txVersion >= tx.txVersion)
if (isStale) throw new E.StaleTxError({ txId: tx.id })
const isStaleFromServer = !fromClient && oldTx && (oldTx.txVersion > tx.txVersion)
if (isStaleFromServer) {
logger.info('trying to update older version of tx', JSON.stringify(tx))
return Promise.resolve()
}
return preProcess(t, oldTx, tx, pi)
.then(preProcessedTx => cashOutLow.upsert(t, oldTx, preProcessedTx))
})